Repository navigation
Expand file tree
/
Copy pathTwelveDaysOfChristmas.java
More file actions
72 lines (64 loc) · 1.89 KB
/
Copy pathTwelveDaysOfChristmas.java
File metadata and controls
72 lines (64 loc) · 1.89 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
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
import java.util.Scanner;
public class TwelveDaysOfChristmas {
public static void main(String[] args) {
// User inputs a number from 1-12, program outputs the day's lyrics from 12 Days
// of Christmas
Scanner sc = new Scanner(System.in);
System.out.print("What day of Christmas is it? (1-12): ");
int day = sc.nextInt();
sc.close();
// Switch statement for initial line
switch (day) {
case 1:
System.out.println("On the 1st day of Christmas, your true love sent to you:");
break;
case 2:
System.out.println("On the 2nd day of Christmas, your true love sent to you:");
break;
case 3:
System.out.println("On the 3rd day of Christmas, your true love sent to you:");
break;
case 4:
case 5:
case 6:
case 7:
case 8:
case 9:
case 10:
case 11:
case 12:
System.out.println("On the " + day + "th day of Christmas, your true love sent to you:");
break;
default:
System.out.println(
"There are only 12 Days of Christmas. Try again! Maybe you'll finally get that Xbox this year.");
}
// Switch statement for true love's gifts
switch (day) {
case 12:
System.out.println("- Twelve (12) drummers drumming");
case 11:
System.out.println("- Eleven (11) pipers piping");
case 10:
System.out.println("- Ten (10) lords a-leaping");
case 9:
System.out.println("- Nine (9) ladies dancing");
case 8:
System.out.println("- Eight (8) maids a-milking");
case 7:
System.out.println("- Seven (7) swans a-swimming");
case 6:
System.out.println("- Six (6) geese a-laying");
case 5:
System.out.println("- FIVE (5) GOLD RINGS");
case 4:
System.out.println("- Four (4) calling birds");
case 3:
System.out.println("- Three (3) french hens");
case 2:
System.out.println("- Two (2) turtle doves");
case 1:
System.out.println("- One (1) partridge in a pear tree");
}
}
}