Question: write Java program - Q2) Write a class Student that has the following 1) Private instance variables ID of type integer. - name of type
write Java program

- Q2) Write a class Student that has the following 1) Private instance variables ID of type integer. - name of type String. - "numCourses of type integer. "scores an array of integers with the size "numCourses. 2) Constructor that initializes student ID, name, and the number of courses. r Computer Programming-2 (CS2301) Exception Handling Lab Session-#06 3) Void method fillScores that asks the user to enter the student scores and store them in the scores array. This method should handle the InputMismatchException. 4) Integer method getOneScore" takes an index of the student score and returns its value. This method should handle the ArrayIndexOutOfBoundsException. 5) Void method that prints all information of the student. In the deriver class, define an object of the Student class and test its functionalities. The program output may be as the following: Enter score 90 Enter score 80 Enter score 70 Enter score 60 Enter score 50 Enter index to get its score 3 60 Student Information ID: 123 Name: Ahmed Number of courses: 5 90 80 70 60 50 Enter score 90 Enter score 80 Enter score 70 Enter score test java.util.Input MismatchException Enter score 60 Enter index to get its score 999 java.lang.ArrayIndexOutOfBoundsException: 999 -1 Student Information ID: 123 Name: Ahmed Number of courses: 5 90 80 70 0 60
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
