randRange(4, 6) randRange(75, 98, LENGTH) (function() { var sum = 0; $.each(SCORES, function( i, elem ) { sum += elem; }); return sum; })()

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))?

SUM / LENGTH

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.

randRange(3, 7) randRange(77, 88) randRange(OLD_AVG + 2, 99)

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?

NEW_AVG + COUNT * (NEW_AVG - OLD_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.

randRange(3, 6) randRange(2, COUNT - 2) randRange(77, 88) (OLD_AVG * COUNT + 100 * REMAINING) / (COUNT + REMAINING)

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?

NEW_AVG

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.