posted 3 years ago

The method I am having issues with is the "printStudentReport" method. I am trying to calculate the average of a randomly generated number of students and tests. My professor has been sick and basically told us to "figure it out." Any advice would be helpful. For my "printTestReport" method, I have to calculate the average of the test by test number.

The method I am having issues with is the "printStudentReport" method. I am trying to calculate the average of a randomly generated number of students and tests. My professor has been sick and basically told us to "figure it out." Any advice would be helpful. For my "printTestReport" method, I have to calculate the average of the test by test number.

posted 3 years ago

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

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

Good luck.

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.

*Practice only makes habit, only perfect practice makes perfect.
Practice mindfully by doing the right things and doing things right.*— Junilu

[How to Ask Questions] [How to Answer Questions]

Consider Paul's rocket mass heater. |