-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDoWhile.java
More file actions
32 lines (26 loc) · 688 Bytes
/
DoWhile.java
File metadata and controls
32 lines (26 loc) · 688 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
package iteration;
import java.io.IOException;
public class DoWhile {
public static void main(String[] args) throws IOException {
char c;
do {
System.out.println("Menu..");
System.out.println("1. Cook");
System.out.println("2. Defroast");
System.out.println("3. Roast");
System.out.println("4. Quick Heat");
System.out.println("Enter your choice: ");
c = (char) System.in.read();
} while (c < '1' || c > '4');
switch (c) {
case '1':
System.out.println("Cooking started...");
break;
case '2':
System.out.println("Defroasting now");
break;
default:
System.out.println("Option is unknwown. Going back to main " + "menu...");
}
}
}