Question: Write a Java program which reads a series of 1 0 integers and find their average. Please notice your program should satisfy the following requirements:
Write a Java program which reads a series of integers and find their average.
Please notice your program should satisfy the following requirements:
Read each input value as a string, and then convert it to an integer.
However, once you catch an invalid integer, you should throw an exception, and print an appropriate error message to remind the customer to reenter a new string which can be converted into a valid integer.
Continue reading values until valid strings are read.
Implement trycatch statement to handle the exception in your program.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
