-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathGrades.java
More file actions
32 lines (29 loc) · 908 Bytes
/
Grades.java
File metadata and controls
32 lines (29 loc) · 908 Bytes
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
import java.util.Scanner;
public class Grades {
static char grade(int total) {
if (total >= 90) {
return 'A';
} else if (total >= 80) {
return 'B';
} else if (total >= 70) {
return 'C';
} else if (total >= 60) {
return 'D';
} else if (total >= 50) {
return 'E';
} else {
return 'F';
}
}
public static void main(String[] args) {
Scanner scanner = new Scanner(System.in);
System.out.println("Enter Marks in Physics, Chemistry and Maths Respectively:");
int phy = scanner.nextInt();
int chem = scanner.nextInt();
int math = scanner.nextInt();
int total = phy + chem + math;
System.out.println("Total Marks : " + total);
System.out.println("Grade : " + grade(total / 3));
scanner.close();
}
}