Exercise #2: Consider the program below: import java.util.*; public class Ex2_Exception public static void main(String[]
Posted: Sat Nov 27, 2021 2:42 pm
Exercise #2: Consider the program below: import java.util.*; public class Ex2_Exception public static void main(String[] args) { Scanner keyboard - new Scanner (System.in); int size = 10; int[] data = new int[size]; double sum=0, avg; for (int i=0; i< size; ++i) { System.out.println("Enter an integer value :"); data[1] = keyboard.nextInt(); sum - sum+data (1): avg = sum/size: System.out.println("Average: "+avg); //End of main ยป// End of class Rewrite the program Use Java exception handling mechanism to handle the following two types of exceptions: (0) Input MishMatchException, and () IndexOutOfBoundsException. 1