Question: Write a JAVA program that prompts the user to read in two integers and then displays their sum. Give a separate prompt for each integer.
Write a JAVA program that prompts the user to read in two integers and then displays their sum. Give a separate prompt for each integer. Your program should prompt the user to enter a number until the numbers format is correct. Here is a sample run indicating how your program should behave:
Enter first integer: hi
Try again. (Incorrect input: an integer is required)
Enter first integer: six
Try again. (Incorrect input: an integer is required)
Enter first integer: 6
Enter second integer: five
Try again. (Incorrect input: an integer is required)
Enter second integer: 5
The sum is 11
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
