I apologize for the simplicity of this question but I have a test question for a online exam and it is asking me to solve this problem:
public class MathUtils {
public static double average(int a, int b) {
return (a+b)/2;
}
public static void main(String[] args) {
System.out.println(average(2, 1));
}
}
There are two test classes that I can not see, I just have to solve for the test class error messages they return. The error I am getting back is:
Integer division wrong answer
1.5 is the answer, which is a double...so I am not sure how this could be the wrong number. I think I am loosing it, so if someone please point out what I am missing I would greatly appreciate it!