Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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:

image text in transcribed

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)

image text in transcribed

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

image text in transcribed

image text in transcribed

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) image text in transcribed

\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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Progress Monitoring Data Tracking Organizer

Authors: Teacher'S Aid Publications

1st Edition

B0B7QCNRJ1

More Books

Students also viewed these Databases questions