Java Grade class, letter grade to number
<p>I'm writing a program that takes a letter grade.  You'd get 4.0 for A, 3.0 for B, and so forth.    If you enter B+ or B-, it will take subtract .3 or add .3 respectively (so B+ would be 3.3).</p>

<p>In my code, when I test a letter like B+ it gives me .3 instead of actually returning the subtracted value of the actual grade. What am I doing wrong?</p>

<pre><code>public class Grade {
    private String grade;
    private double gradeNum;

    // Constructor
    public Grade(String showGrade) {
        grade = showGrade;
        gradeNum = 0;
    }

    // getNumericGrade method to return grade number
    public double getNumericGrade() {
        String suffix;
        suffix = grade.substring(1);

        if(suffix.equals("+")) {
            gradeNum = gradeNum + .3;
        } else if(suffix.equals("-")) {
            gradeNum = gradeNum - .3;
        }

        String letterGrade = grade.substring(0);

        if(letterGrade.equalsIgnoreCase("A")) {
            gradeNum = 4.0;
        } else if(letterGrade.equalsIgnoreCase("B")) {
            gradeNum = 3.0;
        } else if(letterGrade.equalsIgnoreCase("C")) {
            gradeNum = 2.0;
        } else if(letterGrade.equalsIgnoreCase("D")) {
            gradeNum = 1.0;
        } else if(letterGrade.equalsIgnoreCase("F")) {
            gradeNum = 0.0;
        } else {
            System.out.println("Invalid letter grade");
        }

        return gradeNum;
    }
}
</code></pre>
