Back to Challenge Set 14

Code Challenge: Grade Book

Difficulty  

divider

The Brief

What they asked for
Here are the scores from the last test. I want the average,
to one decimal place, and how many students scored above it,
because that tells me whether the average is hiding
anything.

Write your requirements list before you write any code. Input, calculate, output, and anything you had to decide for yourself.


Notes

  • Start with the scores already in an array: 88, 72, 95, 64, 81, 90, 78.
  • You cannot count who is above the average until you know the average. That means two walks through the array, not one.
  • Report the average to one decimal place. Check it with a calculator: a whole number divided by a whole number in C# throws the fraction away, the way Activity 1.20's fishing average did.
  • “Above” means more than the average, not equal to it. Write that down as one of your decisions.

Sample Output

Sample Output
Average: 81.1
3 of 7 students scored above it.

Verified in a real run. The seven scores total 568, and 568 ÷ 7 is 81.14…


Submit

Your requirements list and your program file, named cc-grade-book.

Commence Challenge