-
Notifications
You must be signed in to change notification settings - Fork 0
/
Studentgrade.java
38 lines (36 loc) · 1006 Bytes
/
Studentgrade.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
class Studentgrade {
public static void main(String args[]) {
Scanner sc = new scanner(System.in);
System.out.println("Enter average of your marks (less than 100)::");
int average = sc.nextInt();
char grade;
if(average>=80){
grade = 'A';
}else if(average>=60 && average<80){
grade = 'B';
}
else if(average>=40 && average<60){
grade = 'C';
}
else {
grade = 'D';
}
switch(grade) {
case 'A' :
System.out.println("Excellent!");
break;
case 'B' :
case 'C' :
System.out.println("Well done");
break;
case 'D' :
System.out.println("You passed");
case 'F' :
System.out.println("Better try again");
break;
default :
System.out.println("Invalid grade");
}
System.out.println("Your grade is " + grade);
}
}