Correcting Problems:
Fix the problems in the NumberList program without making any changes to the
NumberListDriverclass.
If a user immediately enters “q” to quit, print “NaN” by making a small program correction that utilizes
double’s NaNvalue, and avoid using the
try-catchmechanism to catch the
intarithmetic exception.
Sample session:
Enter a whole number (q to quit): qMean = NaNIf the entry is not a “q,” and if it is not a legal integer, catch the exception, and in the
catchblock use the
getClassmethod inherited from the
Objectclass to print the name of the exception class followed by the error message with the statement:
System.out.println(e.getClass() + " " + e.getMessage());
Avoid the possibility of an
ArrayIndexOutOfBoundsExceptionby adding to the
whilecondition
size < numList.length,and perform the query and entry at the end of the
whileloop only if
size < numList.length.
We need at least 10 more requests to produce the solution.
0 / 10 have requested this problem solution
The more requests, the faster the answer.