Back to Challenge Set 5

Code Challenge: Letter Grade

Difficulty  

divider

The Brief

What they asked for
Students keep asking me what letter a score is and I keep
doing it in my head. Type a percent, get the letter. And
please make it agree with the syllabus, because last time
someone wrote one that rounded 89.5 up and I heard about it
for a week.

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


Notes

  • The standard bands are 90 an A, 80 a B, 70 a C, 60 a D, and below that an F. Five outcomes, so this is a chain.
  • Whether it rounds is the entire question in this brief. Read what they said about 89.5 again — they are telling you what they want without telling you what they want.
  • Test 89.5, 90, and 90.1 specifically. Your program needs a defensible answer for all three.
  • Write down in your requirements list which choice you made and why. There is no wrong choice here, only an undocumented one.
  • Scores are not whole numbers — 89.5 is right there in the brief.

Sample Output

Sample Output
Score: 89.5
That is a B.

A program that says A here is also correct, if your requirements list says you chose to round. One that has not thought about it is not correct, whichever letter it prints.

Check every band before you submit — a score in the C range and one in the F range will both catch an ordering mistake that 89.5 hides.


Submit

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

Commence Challenge