In his(1) course(1) class, person(1) took LENGTH plural(exam(1)). His(1) scores were toSentence(SCORES).
What was his(1) average score on the plural(exam(1))?
The average is the sum of his(1) scores divided by the number of scores.
There are LENGTH scores and their sum is SCORES.join(" + ") = SUM
.
His(1) average score is SUM \div LENGTH = SUM / LENGTH
.
On the first COUNT plural(exam(1)) of his(1) course(1) class, person(1) got an average score of OLD_AVG.
What does he(1) need on the next exam(1) to have an overall average of NEW_AVG?
Let his(1) score on the next exam(1) be x
.
The sum of all of his(1) scores is then COUNT \cdot OLD_AVG + x
.
The same sum must also be equal to COUNT + 1 \cdot NEW_AVG
.
Solve: x = COUNT + 1 \cdot NEW_AVG - COUNT \cdot OLD_AVG = (COUNT + 1) * NEW_AVG - COUNT * OLD_AVG
.
person(1) has taken COUNT plural(exam(1)) and his(1) average score so far is OLD_AVG.
If he(1) gets 100, a perfect score, on the remaining REMAINING plural(exam(1)), what will his(1) new average be?
If he(1) gets 100 on the remaining plural(exam(1)), the sum of his(1) scores will be COUNT \cdot OLD_AVG + REMAINING \cdot 100 = COUNT * OLD_AVG + 100 * REMAINING
.
His(1) overall average will then be COUNT * OLD_AVG + 100 * REMAINING \div COUNT + REMAINING = NEW_AVG
.