Write a programme that accepts user input from the console. The programme should take a number and then test for the following age ranges: 0 to 10, 11 to 20, 21 to 30, 30 and over. Display a message in the Output window in the following format:
user_age + " is between 21 and 30"
So if the user enters 27 as the age, the Output window should be this:
If the user is 30 or over, you can just display the following message:
"Your are 30 or over"
Help for this exercise
To get string values from the user, you did this:
String age = user_input.next( );
But the next( ) method is used for strings. The age you are getting from the user has to be an integer, so you can't use next( ). There is, however, a similar method you can use: nextInt( ).