Question: Please use JAVA only Write a class named Grade. This class should keep track of a student's grade. The grade itself will be stored as

Please use JAVA only

Write a class named Grade. This class should keep track of a student's grade. The grade itself will be stored as a floating point number, but it should also be able to produce a corresponding letter grade. You may not use any import statements. Any data elements should be declared private, although this will not be graded. If you think it is necessary you may include helper methods of your own. The class should implement the following public methods:

  • public Grade() the constructor will initialize the grade to 100.0.
  • public Grade(double grade) the constructor will initialize the grade to the given value. If a grade less than zero is passed in, then the value should default to zero instead.
  • double getGrade() this getter method will return the student's grade.
  • void setGrade(double grade) this setter method will set a new value of the grade. If a grade less than zero is passed in, then the value should be ignored and the original kept instead.
  • public String toString() returns the letter grade corresponding to the numerical grade. The scale is: "A" for 90 and above; "B" for grades 80 and above but below A; "C" for grades 70 and above but below B; "D" for 60 and above but below C; "F" for all other grades.

All method signatures should match the ones shown exactly.

Please make sure that it passes the following: https://repl.it/@micky123/NeglectedWoozyTruetype

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!