Question: ## Problem Description You are to write a program that will take a grade as a String. This grade has the form of a letter

## Problem Description

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) followed by an ***optional*** sign (e.g. +, -). 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. The + sign add 0.3 to the grade points and the - sign subtracts 0.3. Note that an "A+" is still 4.0 points and an "F+" or "F-" is still 0 grade points. **NOTE: You may not hard-code the return value for +/- grades, but must add or subtract 0.3**

This class will have a constructor that takes one argument and the following two methods:

- ```java

public Grade(String grade)

```

- Constructor that sets the grade as a String. This is the only place the grade is set. This will take a combination of a letter grade and possibly a +/- suffix

- ```java

public String getLetterGrade()

```

- Returns the grade as a String.

- ```java

public double getNumericGrade()

```

- Returns the numeric grade in the range 0.0 <= grade <= 4.0

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.

- "B-". Should return 2.7.

- Invalid grades should return a 0 (Instructor TODO: // Change this requirement to throw an exception for Spring 2020)

**Hints:**

- You should be able to figure out the name of your class from the Constructor specification.

- You can use the **length()** method of the **String** object to figure out how many characters are in your input.

- You can use the **charAt()** method of the **String** object to extract a character from your string.

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!