forked from cs-dept-ibbul/java2019
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab5Switchcase.java
More file actions
76 lines (62 loc) · 1.82 KB
/
Copy pathLab5Switchcase.java
File metadata and controls
76 lines (62 loc) · 1.82 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
64
65
66
67
68
69
70
71
72
73
74
75
76
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package assignment;
import java.util.Scanner;
/**
*
* @author
public class Switchcase {
public static void main(String [] args) {
int score ; char grade;
Scanner input = new Scanner(System.in);
System.out.println("Enter your score");
score = input.nextInt();
switch(score){
case 100:
case 99:
case 98:
case 97:
case 96:
case 95:
case 94:
case 93:
case 92:
case 91:
case 90: grade = 'A'; break;
case 89:
case 88:
case 87:
case 86:
case 85:
case 84:
case 83:
case 82:
case 81:
case 80: grade = 'B'; break;
case 79:
case 78:
case 77:
case 76:
case 75:
case 74:
case 73:
case 72:
case 71:
case 70: grade = 'C'; break;
case 69:
case 68:
case 67:
case 66:
case 65:
case 64:
case 63:
case 62:
case 61:
case 60: grade = 'D'; break;
default: grade = 'F'; break;
}
System.out.println("Your test score is "+ score + ", which is equivalent to the grade " + grade + "."); }
}