-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathChineseZodiac.java
More file actions
38 lines (35 loc) · 1.08 KB
/
ChineseZodiac.java
File metadata and controls
38 lines (35 loc) · 1.08 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
import java.util.Scanner;
/**
* Created by Melissa on 18/04/2017.
*/
public class ChineseZodiac {
public static void main(String[] args) {
Scanner input = new Scanner(System.in);
System.out.print("Enter a year: ");
int year = input.nextInt();
switch (year % 12) {
case 1:
System.out.println("monkey"); break;
case 2:
System.out.println("rooster"); break;
case 3:
System.out.println("dog"); break;
case 4:
System.out.println("pig"); break;
case 5:
System.out.println("ox"); break;
case 6:
System.out.println("tiger"); break;
case 7:
System.out.println("rabbit"); break;
case 8:
System.out.println("dragon"); break;
case 9:
System.out.println("snake"); break;
case 10:
System.out.println("horse"); break;
case 11:
System.out.println("sheep");
}
}
}