Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Write the Java classes shown in the following UML diagram: - Create a class InvalidGradeException, a subclass of RuntimeException - constructor: takes one argument message
Write the Java classes shown in the following UML diagram: - Create a class InvalidGradeException, a subclass of RuntimeException - constructor: takes one argument message (String). B: 1.75 Marks - Create a class student that has id (string), name level (int). Define the following: - Constructor that receives id, name, and level parameters to initialize instant variables. C: 3.75 Marks - Create a class Grade that has student (Student) and grade (char). Define the following: - Constructor that receives student and grade parameters to initialize instant variables. The constructor must check the grade before assign it to grade. If a grade is not ' A ', 'B', ' C ', 'D' or ' F ' it must throw an InvalidGradeException. D: 4-75 Marks - Create a class Course that has id (string), name(string), students(ArrayList ) and greadBook(Arraylist ). Define the following: Constructor that receives id and name parameters to initialize instant variables. getstudent, a method that takes student id and search the list of students. The method returns student object if the id is found. Otherwise, it returns null. addstudent, a method that add a student object to the list of students. getBradeBook, a method to return the gradeBook addGrade, method that takes a student id and a grade and create a new object of type Grade. This method must check if a student is in the list or throw NullPointersxception. Create the driver class T est that contains a main method that does the following (in the specified order): 1. Instantiate 3 objects of Student. (Refer to running example) 2. Instantiate an array of size 3 and add the students. 3. Instantiate an object of Course with the following ("CS151","Object Oriented Programming") 4. Write try/catch/finally blocks 5. Inside the try: Loop over the array and add the students to the course For each student add a grade. 6. From the course object loop over the grades and print out the information (Refer to running example) 7. Inside the catch you must print the stack trace information 8. The finally block must print "Goodbye from finally". 9. To check your work, try to add a grade ' W '. Running example: \begin{tabular}{l} id: 143001 name: Ahmad Ali grade: A \\ id: 143002 name: Amal Muhammd grade: A \\ id: 143003 name: Khaled Ahmad grade: A \\ Goodbye from finally \\ \hline \end{tabular}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started