-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathThe_Switch_Statement_II.java
34 lines (33 loc) · 1.06 KB
/
The_Switch_Statement_II.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
import java.util.Scanner;
public class The_Switch_Statement_II {
public static void main(String[] args){
char choice;
System.out.println("Select your choice");
System.out.println(" M -> Madras");
System.out.println(" B -> Bombay");
System.out.println(" C -> Calcutta");
System.out.println("Choice --->");
System.out.flush();
try {
switch (choice = (char) System.in.read()){
case 'M':
case 'm':
System.out.println("Madras : Booklet 5");
break;
case 'B':
case 'b':
System.out.println("Bombay : Booklet 9");
break;
case 'C':
case 'c':
System.out.println("Calcutta : Booklet 15");
break;
default:
System.out.println("Invalid Choice (IC)");
}
}
catch (Exception e){
System.out.println("I/) Error");
}
}
}