-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathSwitchColorInput.java
More file actions
32 lines (31 loc) · 905 Bytes
/
SwitchColorInput.java
File metadata and controls
32 lines (31 loc) · 905 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
import java.util.Scanner;
public class SwitchColorInput
{
public static void main(String [] args)
{
String gradeInput = "";
Scanner scan = new Scanner(System.in);
System.out.print("Enter your favorite color: ");
gradeInput = scan.nextLine();
switch( gradeInput )
{
case "red":
System.out.println("Apple.");
break;
case "blue":
System.out.println("Like the sky.");
break;
case "yellow":
System.out.println("Banana.");
break;
case "green":
System.out.println("Tree leaves");
break;
case "black":
System.out.println("Night sky");
break;
default:
System.out.println("Wrong.");
}
}
}