generated from fastai/fastpages
-
Notifications
You must be signed in to change notification settings - Fork 1
/
GradeCalculator.java
47 lines (37 loc) · 1.62 KB
/
GradeCalculator.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import java.util.Scanner;
public class GradeCalculator {
public static void main(String args[]) {
Scanner input = new Scanner(System.in);
System.out.println("Seperate category?: ");
boolean category = input.nextBoolean();
if (category == true) {
System.out.println("current grade?: ");
double a = input.nextDouble();
System.out.println("% final: ");
double perc1 = input.nextDouble();
System.out.println("desired grade: ");
double b = input.nextDouble();
double cgrade = a/100 * (100-perc1)/100;
double bgrade = b/100-cgrade;
double perc2 = bgrade/perc1;
System.out.println("needed grade: " + perc2*10000 + "%");
}
else {
System.out.println("current grade?: ");
double cg = input.nextDouble();
System.out.println("% of grade that is in the test category %: ");
double tp = input.nextDouble();
System.out.println("current test grade: ");
double tg = input.nextDouble();
System.out.println("points in test category: ");
double tpt = input.nextDouble();
System.out.println("points in the final: ");
double fp = input.nextDouble();
System.out.println("desired grade: ");
double dg = input.nextDouble();
Double otherPoint = cg - (tg*(tp/100));
Double needed = (((dg - otherPoint) * (tpt+fp))/tp)-tg;
System.out.print("You need " + needed + " points on the test");
}
}
}