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 10 integers and find their average.
Please notice your program should satisfy the following requirements:
1) Read each input value as a string, and then convert it to an integer.
2) 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.
3) Continue reading values until 10 valid strings are read.
4) Implement try-catch statement to handle the exception in your program.
 Write a Java program which reads a series of 10 integers

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 Databases Questions!