Can anyone tell me what I am doing wrong in this code?
public class grades {
public static void main(String[] args) {
int[] testMarks = Marks.getMarks();
System.out.print(grading(testMarks));
}
public static char[] grading(int[] testMarks) {
char grade = '0';
char[] grades = new char[grade];
int value = 0;
int n = 0;
while (n < testMarks.length) {
value = testMarks[n];
if (value >= 90) {
grade = 'A';
}
else if (value < 90 && value >= 75) {
grade = 'B';
}
else if (value < 75 && value >= 60) {
grade = 'C';
}
else if (value < 60 && value >= 50) {
grade = 'D';
}
else if (value < 50 && value >= 45) {
grade = 'E';
}
else {
grade = 'F';
}
n =+ 1;
}
return grades;
}
}
I am trying to return the values of the testMarks array as char based on the boundaries listed. I don't get any errors, but it doesn't display anything.
Cheers, Em