Final Grade Calculator (calculates necessary score for the final):

  • First takes in boolean of whether final is in a seperate category or tests cateogry
  • If final is in seperate category
    • take in current grade
    • take in % of grade that is final
    • take in the desired grade
    • output % score needed on the final
  • If final is in a "tests" category
    • take in current grade
    • take in % of grade that is tests category
    • take in current % in tests category
    • take in CURRENT amount of points in tests category (here integer can be used i suppose)
    • take in amount of points that the final is (here integer can be used i suppose)
    • take in the desired grade
    • output # of points needed on the final All of these should be taken using user input (Scanner). Example Input: false 20 93.0 90.0 Example Output (would be correct if contains a 78): Is the final in the tests category? What is your current grade? How much percent of your grade is the final? What is your desired grade? You need a 78.0 on the test
import java.util.Scanner;  // Import the Scanner class
int separate = 0;
double g = 96; // Current Class Grade
double percentFinal = 30;
double finalScore = 0;
int t = 80; // test percent of the grade
int p = 300; // point in the test category
int f = 100; // points that the final is worth
double a = 92; // percent of points scored within the test category
double w = 90; // wanted grade

Scanner finalQ = new Scanner(System.in);  // Create a Scanner object
System.out.println("Is the final in its own category? \n 1 - True \n 2 - False");
separate = finalQ.nextInt();
if(separate == 1){
    System.out.println("What is your current grade?");
    g = finalQ.nextDouble();
    System.out.println("How much percent of your grade is the final?");
    percentFinal = finalQ.nextDouble();
    System.out.println("What is your desired grade?");
    w = finalQ.nextDouble();
    finalScore = (w -g * (100.0- percentFinal)/100) / (percentFinal/100);
    System.out.print("You need to get at least a " + String.format("%.2f", (finalScore/f)*100) + "% on you final to get a " + w);
}
else if(separate == 2){
    System.out.print("What is your current grade? ");
    g = finalQ.nextDouble();
    System.out.println(g);

    System.out.print("How much is your test category worth? ");
    t = finalQ.nextInt();
    System.out.println(t);

    System.out.print("How many point are in the test category? ");
    p = finalQ.nextInt();
    System.out.println(p);

    System.out.print("How many point is the final? ");
    f = finalQ.nextInt();
    System.out.println(f);

    System.out.print("What is your grade in the test category? ");
    a = finalQ.nextDouble();
    System.out.println(a);

    System.out.print("What is your desired grade? ");
    w = finalQ.nextDouble();
    System.out.println(w);

    finalScore = ((0.01*a*f*t)-(f*g)+(f*w)-(g*p)+(p*w))/t;
    System.out.print("You need to get at least a " + String.format("%.2f", (finalScore/f)*100) + "% on you final to get a " + w);
}
else{
    System.out.print("Unexpected choice, try again.");
}
Is the final in its own category? 
 1 - True 
 2 - False
What is your current grade?
How much percent of your grade is the final?
What is your desired grade?
You need to get at least a 1.00% on you final to get a 1.0