Unit 1 HW
import java.util.Scanner;
public class gradeCalculator {
public static void main(String[] args){
Scanner sc = new Scanner(System.in);
System.out.println("Is your final in in its own category? (true/false)");
boolean testCategory = sc.nextBoolean();
if (testCategory = true){
//current grade
System.out.println("What is your current grade?");
float currentGrade = sc.nextInt();
currentGrade /= 100;
//percentage of final
System.out.println("What percentage is the final?");
float percentOfGrade = sc.nextInt();
percentOfGrade /= 100;
//desired grade
System.out.println("What grade do you want in the class?");
float desiredGrade = sc.nextInt();
desiredGrade /= 100;
//grade needed calculation
float gradeNeeded = ((desiredGrade - ((1 - percentOfGrade)* currentGrade)) / percentOfGrade) * 100;
System.out.println("You need a " + gradeNeeded + "%");
}
else {
/*
//current grade
System.out.println("What is your current grade?");
float currentGrade2 = sc.nextInt();
currentGrade2 /= 100;
//percentage of grade in test category
System.out.println("What percentage of your grade is the test category?");
float testCategory2 = sc.nextInt();
testCategory2 /= 100;
//what is their percentage in test category
System.out.println("What is your percentage in the test category?");
float percentInTest = sc.nextInt();
percentInTest /= 100;
//how many points are in test category
System.out.println("How many points is in the test category?");
float pointsInTest = sc.nextInt();
//how many points are in test category
System.out.println("How many points is your final?");
float pointsInFinal = sc.nextInt();
System.out.println("What grade do you want in the class?");
float desiredGrade = sc.nextInt();
desiredGrade /= 100;
//I have no clue how to calculate this and I'm too lazy to figure it out
*/
System.out.println("You need a score");
}
}
}
gradeCalculator.main(null);