Question: I need Java program for this Write a program that reads 5 numbers. It prints the total. Your program must handle the exception and makes

I need Java program for this Write a program that reads 5 numbers. It prints the total.
Your program must handle the exception and makes the user re-input the number.
Hint: the exception that can occur is java.util.InputMismatchException
You are provided the code to read 5 numbers. Modify it to handle exceptions describe above.
Sample run
Enter a number: 5
Enter a number: a
Input must be a integer.
Enter a number: 3
Enter a number: hello
Input must be a integer.
Enter a number: 4
Enter a number: 2
Enter a number: world
Input must be a integer.
Enter a number: 1
total=15

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Accounting Questions!