-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSwitchCase.java
67 lines (50 loc) · 1.08 KB
/
SwitchCase.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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
package WEEK6;
import WEEK5.Scanner;
public class SwitchCase {
public static void main(String[] args) {
// System.out.println( 5 == 5);
//System.out.println( 5==6);
//System.out.println(5! = 0);
//System.out.println(5! ==6);
//SWITCH CASE
java.util.Scanner note = new Scanner (System.in);
System.out.println("what is the note?");
int grade= note.nextInt();
switch (grade) {
case 90: // if (grade==90)
System.out.println("A");
break;
case 80 :
System.out.println("B");
break;
case 70 :
System.out.println("C");
break;
case 60 :
System.out.println("D");
break;
default :
System.out.println("F");
}
char letter = 'A'
switch (letter) {
case 'A'
System.out.println("well done");
break;
case 'B':
System.out.println("Not nad ");
break;
case 'C':
System.out.println("could have been better");
break;
case 'D':
System.out.println("try harder");
break;
case 'F':
System.out.println(" try again ");
break;
default:
System.out.println("Invalid letter");
}
}
}