|
First Summer 2006 |
| 8. |
Write a program (called Eight)
For example,
Break ties in favor of the better grade; for example 2.85 should be a |
Here's a sample run of such a program:
frilled.cs.indiana.edu%java Eight Enter numeric score then press Enter : 3.85 A frilled.cs.indiana.edu%java Eight Enter numeric score then press Enter : 3.84 A- frilled.cs.indiana.edu%java Eight Enter numeric score then press Enter : 3.5 A- frilled.cs.indiana.edu%java Eight Enter numeric score then press Enter : 3.49 B+ frilled.cs.indiana.edu%java Eight Enter numeric score then press Enter : 3.1 B frilled.cs.indiana.edu%java Eight Enter numeric score then press Enter : 10 A+ frilled.cs.indiana.edu%java Eight Enter numeric score then press Enter : -2 frilled.cs.indiana.edu%java Eight Enter numeric score then press Enter : -0.5 frilled.cs.indiana.edu% | |
You, of course, need to write a program in Python.
Before you work out this problem here are some questions, for your warm-up.
These questions are good practice, yet you don't need to turn them in:
If the number you enter is positive the program asks for a second number, otherwise it ends.
1, 2,
3, or 4 (as an integer)
one",
"two", "three", or
"four" depending on the number that was
entered.
If the number does not match the program prints "sorry".
-50 and 50 every time you call it.
123" and
adds its digits to produce 6.
23:59"
23, in
this case) and one for the minutes (59, here).
3.85
A (by printing the letter grade A to the
screen in response),
3.5 and 3.85 into an A-,
3.15 and 3.5 into a B+
Unknown" type of message.