Question: You are to write a program that will take a grade as a String. This grade has the form of a letter (e.g. A, B,

You are to write a program that will take a grade as a String. This grade has the form of a letter (e.g. A, B, C, D, F). The letter values are worth 4.0 grade points for an A, 3.0 for a B, 2.0 for a C, 1.0 for a D, and 0 for an F.
This object will have a constructor that takes one argument and the following two methods:
public Grade(String grade) - Constructor that sets the grade as a String. This is the only place the grade is set.
public String getLetterGrade() - Returns the grade as a String.
public double getNumericGrade() - Returns the numeric grade in the range 0.0 <= grade <= 4.0
Getting Started
We are going to do this exercise by writing the object that solves the problem first (in a source file called Grade.java) and then testing it using code we write into Program.java. Using the techniques shown on the web page titled "How to Start Every Project in this Class" create a source file called Grade.java as well as a file called Program.java.
Use the problem description to figure out which methods need to be added to the source file.
Your Program.java should contain code to test your Grade object. Your test grades should be:
"A". Should return 4.0.
"B". Should return 3.0.
"C". Should return 2.0.
Once you've written your code run the code by single clicking on Program.java in the package explorer and selecting Run->Run from the menu or using the keyboard shortcut. Examine the output. Does it do what you want? If not, how can you modify the code to do what you want?

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!