X1528: Calculate Quiz Grade Needed

Write a function in Java that calculates what grade a student needs on the next quiz to reach a target average. Given three ints: pastQuizzes and currentAverage, and targetAverage, calculate what score (out of 100) is needed on the next quiz to achieve the new target average.

This can be calculated by converting both the averages to the total points using multiplication, and then finding the difference between them (which would be the next quiz's needed score). Remember that the total points for the target grade should include the extra quiz!

Example: There have been 4 quizzes so far. The current average on them is an 85. But the target average is a 90.

current total points: 85 * 4 = 340

target total points: 90 * 5 = 450

needed next quiz grade = 450 - 340 = 110

Your Answer:

Reset

Practice a different Java exercise

Feedback

Your feedback will appear here when you check your answer.