HW
// java style to import library
import java.util.Scanner;
// class must alway have 1st letter as uppercase, CamelCase is Java Class convention
public class ScanPrimitives {
public static void main(String[] args) {
Scanner myObj = new Scanner(System.in); // Create a Scanner object
System.out.println("Is the final in a seperate category? True to False");
boolean tof = myObj.nextBoolean(); // Read user input
System.out.println("Final in a seperate category is " + tof); // Output user input
if (tof) {
System.out.println("What is your current grade rn?");
double grade = myObj.nextDouble();
System.out.println(grade);
System.out.println("What is % of grade that is final?");
double percent = myObj.nextDouble();
System.out.println(percent + "%");
System.out.println("What is your desired grade?");
double desired = myObj.nextDouble();
System.out.println(desired);
double output = (desired - (grade * ((100-percent)/100)))/(percent/100);
System.out.println("You need a " + output + " on your final");
}
else {
System.out.println("What is your current grade rn?");
double grade = myObj.nextDouble();
System.out.println(grade);
System.out.println("What is the % of grade that is test category?");
double percent = myObj.nextDouble();
System.out.println(percent + "%");
System.out.println("What is current % in tests category?");
double currentpercent = myObj.nextDouble();
System.out.println(currentpercent + "%");
System.out.println("What is the current amount of points in the test category?");
int currentpts = myObj.nextInt();
System.out.println(currentpts);
System.out.println("How many pts is the final?");
int pts = myObj.nextInt();
System.out.println(pts);
System.out.println("What is your desired grade?");
double desired = myObj.nextDouble();
System.out.println(desired);
// double output = (desired - ((grade * currentpercent)*((100 - percent) / 100)))/((currentpts + pts)/(percent / 100))- currentpts;
double output = ((desired - grade+currentpercent)*(currentpts+pts)-currentpts*currentpercent)/100;
// double output =
// desired = percent *
// current grade =
System.out.println("You need " + output + " pts on your final");
}
}
}
ScanPrimitives.main(null);