You wrote an application named DistanceFromAverage that allows a user to enter up to 20 double values

Question:

You wrote an application named DistanceFromAverage that allows a user to enter up to 20 double values and then displays each entered value and its distance fromthe average. Now,modify that programto first prompt the user to enter a number that represents the array size. Java generates a NegativeArraySizeException if you attempt to create an array with a negative size, and it creates a NumberFormatException if you attempt to create an array using a nonnumeric value for the size. Handle these exceptions using a catch block that displays an appropriate message. If the array is created successfully, use exception-handling techniques to ensure that each entered array value is a double before the program calculates each element’s distance from the average. Save the file as DistanceFromAverageWithExceptionHandling.java.

Fantastic news! We've Found the answer you've been seeking!

Step by Step Answer:

Related Book For  book-img-for-question
Question Posted: