ITEC 120 LAB 16 Back to Lab index page

Write a Java program (one file, one main method) that will print out all 12 verses of the song "The Twelve Days of Christmas". Each verse adds one line. The first two verses are:

On the 1st day of Christmas, my true love gave to me
A partridge in a pear tree.

On the 2nd day of Christmas, my true love gave to me
Two turtle doves, and
A partridge in a pear tree.

Hints: Use a loop to loop through all the days. Use a switch statement for the verses. Think about the best way to order the cases in the statement. (Your program can be done in less than 70 lines of code.) Use a separate switch statement to put the correct suffix on 1st, 2nd, 3rd, etc.

The final verse of the song is:

On the 12th day of Christmas, my true love gave to me
Twelve drummers drumming,
Eleven pipers piping,
Ten lords a leaping,
Nine ladies dancing,
Eight maids a milking,
Seven swans a swimming,
Six geese a laying,
Five golden rings,
Four calling birds,
Three french hens,
Two turtle doves, and
A partridge in a pear tree.