Question: Part 2: Part 3: Part 4: Create a new exception called NumberTooLargeException in the com.day4.practice2 package. Update the updateArray method. Have it throw a NumberTooLargeException

 Part 2: Part 3: Part 4: Create a new exception calledNumberTooLargeException in the com.day4.practice2 package. Update the updateArray method. Have it throw

a NumberTooLargeException if the new value is greater than 100. Update themain method to call updateArray passing in the number array, index of

Part 2:

0, and a value of 101. Have the method also catch the

Part 3:

NumberToolargeException and print the stacktrace. Class outline: NumberTooLargeException S F serialVersionUID :

Part 4:

long ExceptionDemo S main(String[]) : void S updateArray(int[], int, int) : void

Create a new exception called NumberTooLargeException in the com.day4.practice2 package. Update the updateArray method. Have it throw a NumberTooLargeException if the new value is greater than 100. Update the main method to call updateArray passing in the number array, index of 0, and a value of 101. Have the method also catch the NumberToolargeException and print the stacktrace. Class outline: NumberTooLargeException S F serialVersionUID : long ExceptionDemo S main(String[]) : void S updateArray(int[], int, int) : void S getDouble0 : double s updateFlightPrice(Flight, double) : void s moveByWalking(Robot, double) : void NumberTooLargeException class: public class NumberTooLargeException extends Exception \{ private static final long serialVersionUID = 1L; ExceptionDemo, updateArray method (changes shown): public static void updateArray(int [] numbers, int index, int newValue) throws NumberTooLargeException if (newValue >100 ) \{ throw new NumberTooLargeException(); \} numbers[index] = newValue; ExceptionDemo, main method (changes shown): Output: Console & ExceptionDemo (1) [Java Application] C:IProgram FilesVavaljrel. 8.0_2111bin ljavaw.exe (Oct 28, 2019, 12:37:09 PM) com. day3. pactice3. NumberTooLargeException at com.day3.pactice3. ExceptionDemo. updateArray (ExceptionDemo.java: 32) at com.day3.pactice3. ExceptionDemo.main (ExceptionDemo. java:14) Create a new exception called InvalidPriceException in the com.day3.practice2 package. Change the updateFlight method so the method throws an InvalidPriceException if the price is less than $39. Class outline: InvalidPriceException uSF serialVersionUID : long ExceptionDemo s main(String[]) : void s updateArray(int[], int, int) : void s getDouble 0 : double s updateFlightPrice(Flight, double) : void S moveByWalking(Robot, double) : void Create a new exception called NumberTooSmallException in the com.day4.practice2 package. Make the system ask for a number greater than zero. Have the getDouble method check to see if the value is zero or less. If so, have getDouble throw a NumberTooSmall exception. Update the main method and have call to the getDouble method also catch this exception and print the stacktrace. Class outline: NumberTooSmallException NSF serialVersionUID : long C) ExceptionDemo 5 main(String[]) : void s updateArray(int[l], int, int) : void s getDouble0 : double s updateFlightPrice(Flight, double) : void s moveByWalking(Robot, double) : void Create a new exception called InvalidRobotTypeException in the com.day4.practice2 package. Update the moveByWalking method so it catches the ClassCastException and throws a new InvalidRobotTypeException. Update the main method so that call to the moveByWalking catches this exception and prints the stacktrace. Class outline: InvalidRobotTypeException SF s serialVersionUID : long ExceptionDemo s main(String[]) : void s updateArray(int[l], int, int) : void s getDouble0 : double s updateFlightPrice(Flight, double) : void s moveByWalking(Robot, double) : void

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!