-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathLab_1.java
More file actions
45 lines (40 loc) · 1.01 KB
/
Copy pathLab_1.java
File metadata and controls
45 lines (40 loc) · 1.01 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
package animals;
public class Lab01 {
public static void main(String[] args) {
Console con = new Console();
public static void main (String[]args) {
char (val = e);
if (val='e')
System.out.println("exit");
break;
switch (val) {
case 'a':
System.out.println('Alligator');
break;
case 'b':
System.out.pritnln('Bear');
break;
case 'c':
System.out.println('Cat');
break;
case 'd':
System.out.println('Dog');
break;
default:
System.out.println('Enter a letter please...');
}
}
// TODO
// Here you must add code to do the following:
// 1) Read a command from the console.
// 2) If the command is 'e', print "Exit" and
// exit the program using System.exit().
// 3) Otherwise, print the corresponding message
// for each command:
// 'a' -> "Alligator"
// 'b' -> "Bear"
// 'c' -> "Cat"
// 'd' -> "Dog"
// 4) Loop until the console returns an 'e'.
}
}