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:
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)
Part-II Testing Grade (25 marks) Given the following startup code of a Java class:
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
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