I'm trying to develop a quickgrade calculator program to compute the average of student grades. Here's the code snippet I have so far:
int[] gradesArray = {88, 90, 84, 70, 95, 78, 82, 74, 89, 91};
int sum = 0, index = 0;
while (index < gradesArray.length) {
sum += gradesArray[index];
index++;
}
int average = sum / gradesArray.length;
System.out.println("The calculated average is: " + average);
I'm puzzled about why it isn't functioning as expected. Can anyone identify any issues or provide suggestions for improvement?