If the user enters a String, what methods are you allowed to use to determine if that String is all numeric digits or if it contains letters?
One way is to use try{} catch block with an Integer...
Type: Posts; User: Norm
If the user enters a String, what methods are you allowed to use to determine if that String is all numeric digits or if it contains letters?
One way is to use try{} catch block with an Integer...
You must have a use for the data in the String or you would not have asked the user to enter it.
Please explain what the data in the String is used for? Why does your program get that data?
You have a problem with the input. You can input numbers with readInt() or you can input Strings with another method.
But then you have to test that the String is a valid number before you can...
What is the datatype of the variable that contains the data that you must test? Is it a number like an int or is it a String?
That will determine what kind of conditional tests you can do in the...
That's what happens when the user enters the wrong data.
You can handle that exception by using try{<your code here>}catch
How are you reading the input from the user? What datatype does the readInt() method return?
What happens if the user does not enter a valid number?
That's right. You can use the AND test to see if a number is in a range. A number can be both > 10 and < 20.
There is no number that is both < 0 and > 1000.
You want to repeat the loop if the...
What value is both < 0 and > 1000?
Would you want to loop back if either is true vs both being true?