Question: Part-I Grade Class (60 marks) Given the following startup code of a Java class: 1. Adding Setter & Getter Methods of the following instance variables

Part-I Grade Class (60 marks) Given the following startup code of a Java class:

Part-I Grade Class (60 marks) Given the following startup code of a

1. Adding Setter & Getter Methods of the following instance variables (25 marks) (a) quizzes (5 marks) (b) labs (5 marks) (c) assignments (5 marks) (d) midtermEXam (5 marks) (e) finalEXam (5 marks)

2. Adding Constructors (20 marks) (a) Add a default constructor Grade() that initializes all the assessments grades to 0.0 (3 marks) (b) Add a constructor with four parameters Grade(double quizzes, double labs, double assignments, double midtermExam, double finalExam) that initializes a grade based on the supplied arguments (5 marks) (c) Add a constructor with one parameter Grade(Grade grade) that makes a copy of the passed grade (6 marks) (d) Add a constructor with one parameter Grade(double [] grades) that initializes the grade from an array (6 marks)

3. Add a method private double computeCourseGrade() that computes the course grade by using the weighted average (5 marks) 4. Add a method private String computeGradeLetter() that computes the Grade Letter based the letter grading scheme specified in the course outline (5 marks) 5. Add a method toString() that returns a string representation of a grade object in the format (see figure 1 on page 4)

Java class: 1. Adding Setter & Getter Methods of the following instance

Part-II Testing Grade (25 marks) Given the following startup code of a Java class:

variables (25 marks) (a) quizzes (5 marks) (b) labs (5 marks) (c)

assignments (5 marks) (d) midtermEXam (5 marks) (e) finalEXam (5 marks) 2.

1. Write the code of public static double[] generateRandomGrades(Random random) that generates an array of 5 random grade between 40 and 100 inclusive (5 marks) 2. Add a code in the main() method that instantiates 5 grade objects and initializes each grade to random grades, and store them in ArrayList grades (see figure 2 on page 5) (20 marks) Adding Constructors (20 marks) (a) Add a default constructor Grade() that initializes

\begin{tabular}{r|rl} 1 & package util; \\ 2 & public class Grade \{ \\ 3 & & \\ 4 & private final double QUIZZES_WEIGHT - .15; \\ 5 & private final double ASSIGNMENTS_WEIGHT - .15; \\ 6 & private final double LABS_WEIGHT - .10; \\ 7 & private final double MIDTERM_WEIGHT - .30; \\ 8 & private final double FINAL_WEIGHT - . 30; \\ 9 & private double quizzes; \\ 10 & private double labs; \\ 11 & private double assignments; \\ 12 & private double midtermExam; \\ 13 & private double finalexam; \\ 14 & & \\ 15 & & \\ 16 & & \end{tabular} Quizzes Grade: 79.06 Labs Grade: 78.62 Assignments Grade: 94.78 Midterm Exam Grade: 47.59 Final Exam Grade: 51.74 Course Grade: 63.74 Grade Letter: C \begin{tabular}{r|l} 1 & package util; \\ 2 & import java.util. Arraylist; \\ 3 & import java.util. Random; \\ 4 & \\ 5 & public class TestingGrade \{ \\ 6 & \\ 7 & public static double[] generateRandomGrades (Random random) \\ 8 & \{ \\ 9 & // your code goes here \\ 10 & \end{tabular} Figure 2: TestingGrade Output

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!