-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathStudentGradeCalculator.java
More file actions
63 lines (54 loc) · 2.01 KB
/
Copy pathStudentGradeCalculator.java
File metadata and controls
63 lines (54 loc) · 2.01 KB
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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
import java.util.Scanner;
class StudentGradeCalculator
{
public static void main(String[] args)
{
Scanner inputMarks = new Scanner(System.in);
System.out.println("Subject 1 (out of 100):");
float sub1 = inputMarks.nextFloat();
System.out.println("Subject 2 (out of 100):");
float sub2 = inputMarks.nextFloat();
System.out.println("Subject 3 (out of 100):");
float sub3 = inputMarks.nextFloat();
System.out.println("Subject 4 (out of 100):");
float sub4 = inputMarks.nextFloat();
float total = sub1+sub2+sub3+sub4;
float percentage = total/4;
System.out.println("\nTotal Marks = " + total);
System.out.println("Average Percentage = " + percentage);
if (percentage >= 90 && percentage == 100)
{
System.out.println("Grade = A+");
}
else if (percentage >= 80)
{
System.out.println("Grade = A");
}
else if (percentage >= 65)
{
System.out.println("Grade = B+");
}
else if (percentage >= 55)
{
System.out.println("Grade = B");
}
else if (percentage >= 30)
{
System.out.println("Grade = C");
}
else
{
System.out.println("Grade = F");
}
System.out.println("\n");
System.out.println("-----------------------------------------------------");
System.out.println("Grade scale chart : ");
System.out.println("-----------------------------------------------------");
System.out.println("90 - 100% = A+ = Very Good");
System.out.println("80 - 89% = A = Good");
System.out.println("65 - 79% = B+ = Average");
System.out.println("55 - 64% = B = Below Average");
System.out.println("30 - 54% = C = Pass");
System.out.println("29% and below = F = Fail");
}
}