Zach Follmer wrote:I have to calculate the average of the test by test number.
As I understand this, you need to get the average score that students got on a particular test. So if there are 2 students who took Test#1 and student 1 scored 50 and student 2 scored 100, the average for Test#1 would be 75. If those same two students took Test#2 and scored 80 and 90, respectively, the average for Test#2 would be 85. Correct?
As a student, you
should try to figure it out. Our usual advice is to do it first with pen and paper. How would do this manually?
I'll give you a hint though:
you should use another array to hold the totals of the scores for each test. That is, if you have 5 tests, then you should have an array, say
int[] totals and make it big enough to hold the total of the scores for each of those 5 tests. Since you know how many students there are, it's an easy thing to iterate through this array and calculate the average for each test.
Good luck.