Could someone tell me how to put an error message in to the following code? If the user enters a number that is not between 0 and 12, how do I output "Invalid entry".
The program at the moment works fine and if an invalid character is entered the user is allowed to try again.
int hours; do { System.out.print("Enter hours: "); hours = myscanner.nextInt(); } while (hours < 0 || hours > 12);
if(....) System.out.println("Error");?