Next: Print the date
Up: Programming assignment
Previous: Programming assignment
- 1.
- Create a new project named Ordinal.
. Put it in a new folder
named Ordinal, and name the class Ordinal. Make it an Application
(not an Applet).
- 2.
- Use a nested if structure to print ordinal values as on the
quiz. Note that the implementation I showed on the quiz was not
quite correct, because it would not handle numbers in the teens
correctly.
HINT: You will need to find the rightmost digit of a number and the
rightmost two digits. You can use the modulus operator (%) to do that.
For example, what's 2467457845 % 10?
Allen B. Downey
2/18/1998