previous | index | next

Step 1: Handle Negative Input

Modify the program so that it insists that the input be nonnegative:
    How old are you? -13
    Age can't be negative
    How old are you? -26
    Age can't be negative
    How old are you? 13
    Next year, you'll be 14

This is accomplished by adding a simple loop to the main method.


previous | index | next