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
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