package bestgpacalculator;

/**
 * Class used to convert letter or number grade to their counterparts.
 * @author james & Steven
 */
public class Decryptor {

    public double[] decryptletterGrade(String letter) {
        //range for the letter grades
        //Steven
        double range[] = new double[2];

        switch (letter) {
            case "A+":
                range[0] = 97.5;
                range[1] = 100;
                break;

            case "A":
                range[0] = 92.5;
                range[1] = 97.4;
                break;

            case "A-":
                range[0] = 90.0;
                range[1] = 92.4;
                break;

            case "B+":
                range[0] = 87.5;
                range[1] = 89.9;
                break;

            case "B":
                range[0] = 82.5;
                range[1] = 87.4;
                break;

            case "B-":
                range[0] = 80.0;
                range[1] = 82.4;
                break;

            case "C+":
                range[0] = 75.5;
                range[1] = 79.9;
                break;

            case "C":
                range[0] = 72.5;
                range[1] = 75.4;
                break;

            case "C-":
                range[0] = 70.0;
                range[1] = 72.4;
                break;

            case "D+":
                range[0] = 67.5;
                range[1] = 69.9;
                break;

            case "D":
                range[0] = 62.5;
                range[1] = 67.4;
                break;

            case "D-":
                range[0] = 60.0;
                range[1] = 62.4;
                break;
            default:
                range[0] = 0.0;
                range[1] = 59.9;
        }

        return range;
    }

    public String decryptNumberGrade(double value) {
        //Author: James Bernard
        //Converts number value of grade to its letter counter part.
        String letter = "F";
        
        if (value >= 97.5) {
            letter = "A+";
        } else if (value >= 92.5) {
            letter = "A";
        } else if (value >= 90) {
            letter = "A-";
        } else if (value >= 87.5) {
            letter = "B+";
        } else if (value >= 82.5) {
            letter = "B";
        } else if (value >= 80) {
            letter = "B-";
        } else if (value >= 77.5) {
            letter = "C+";
        } else if (value >= 72.5) {
            letter = "C";
        } else if (value >= 70) {
            letter = "C-";
        } else if (value >= 67.5) {
            letter = "D+";
        } else if (value >= 62.5) {
            letter = "D";
        } else if (value >= 60) {
            letter = "D-";
        }else{
            letter = "F";
        }

        return letter;
    }
}

@@ -399,16 +399,17 @@
 %5D = 97.5
+0
 ;%0D%0A     
@@ -516,16 +516,17 @@
 %5D = 92.5
+0
 ;%0D%0A     
@@ -551,16 +551,17 @@
 %5D = 97.4
+9
 ;%0D%0A     
@@ -634,18 +634,16 @@
 %5B0%5D = 90
-.0
 ;%0D%0A     
@@ -668,16 +668,17 @@
 %5D = 92.4
+9
 ;%0D%0A     
@@ -753,16 +753,17 @@
 %5D = 87.5
+0
 ;%0D%0A     
@@ -788,16 +788,17 @@
 %5D = 89.9
+9
 ;%0D%0A     
@@ -872,16 +872,17 @@
 %5D = 82.5
+0
 ;%0D%0A     
@@ -907,16 +907,17 @@
 %5D = 87.4
+9
 ;%0D%0A     
@@ -990,18 +990,16 @@
 %5B0%5D = 80
-.0
 ;%0D%0A     
@@ -1024,16 +1024,17 @@
 %5D = 82.4
+9
 ;%0D%0A     
@@ -1109,16 +1109,17 @@
 %5D = 75.5
+0
 ;%0D%0A     
@@ -1144,16 +1144,17 @@
 %5D = 79.9
+9
 ;%0D%0A     
@@ -1228,16 +1228,17 @@
 %5D = 72.5
+0
 ;%0D%0A     
@@ -1263,16 +1263,17 @@
 %5D = 75.4
+9
 ;%0D%0A     
@@ -1346,18 +1346,16 @@
 %5B0%5D = 70
-.0
 ;%0D%0A     
@@ -1380,16 +1380,17 @@
 %5D = 72.4
+9
 ;%0D%0A     
@@ -1465,16 +1465,17 @@
 %5D = 67.5
+0
 ;%0D%0A     
@@ -1500,16 +1500,17 @@
 %5D = 69.9
+9
 ;%0D%0A     
@@ -1584,16 +1584,17 @@
 %5D = 62.5
+0
 ;%0D%0A     
@@ -1619,16 +1619,17 @@
 %5D = 67.4
+9
 ;%0D%0A     
@@ -1702,18 +1702,16 @@
 %5B0%5D = 60
-.0
 ;%0D%0A     
@@ -1736,16 +1736,17 @@
 %5D = 62.4
+9
 ;%0D%0A     
@@ -1817,10 +1817,8 @@
 %5D = 
-0.
 0;%0D%0A
@@ -1848,16 +1848,17 @@
 %5D = 59.9
+9
 ;%0D%0A     

Increase range accuracy.