public void computeAverage(String [] names, int [] scores, char [] grades){
int av = 0;
for (int i = 0; i < names.length; i++)
av = (scores[i]++ / 26);
System.out.print(av);
}
Hey guys,
Above is my code to read a list of test scores and compute their average. There are 26 test scores. I am having trouble, Please help!
Thanks
The problem here is that you keep writing over the
avvariable during each iteration of the loop. Also, it looks like you don’t needs thenamesandgradesarrays as parameters, as you’re not using them. This should work better: