Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JAVA Use two classes to do this. Name the first class TestGrade (I have a starter for this below that must run against your Grade

JAVA

Use two classes to do this. Name the first class TestGrade (I have a starter for this below that must run against your Grade class - In other words you have no choice for the names of the setters), it will be a driver class that is to create instances of the second class(Grade).

/* quiz1 0-10 quiz2 0-10 quiz3 0-10

25% total

mid|term 0-100

35% total

final 0-100

40% total */

public class TestGrade { public static void main(String[] args) { // all grades default to 0 Grade grade1 = new Grade();

grade1.setQuiz1(10); grade1.setQuiz2(10); grade1.setQuiz3(10);

grade1.setMid|term(100); grade1.setFinal(100); System.out.println("The percent grade is: " + grade1.getPercentGrade() + "The letter Grade is: " + grade1.getLetterGrade() );

System.out.println(grade1);

/* Quiz1: 10 Quiz2: 10 Quiz3: 10 Mid|term : 100 Final: 100 Percent Grade: 100.00 Letter Grade: A

*/ Grade grade2 = new Grade(10,10,10,100,100);

System.out.println(grade1.equals(grade2)); // prints true

} } The second class will be named Grade, this is where all the core logic in contained. In the Grade class only have 5 instance variables (quiz1-quiz3, mid|term, and _final). Default all scores to 0 in the default constructor The setters must validate input and if the value it too high set to the max allowed value. If to low set to 0. Be sure to round the return value from getPercentGrade to a hundredth.

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

More Books

Students also viewed these Databases questions