Twelve Days of Christmas

In this task, you're going to use your programming skills to print the words to the Christmas song The Twelve Days of Christmas.

How Will It Work?

If you can't remember how the song goes, or would like to read more about it, have a look at the Twelve Days of Christmas Wikipedia page.

Now you're getting better at programming, I'm going to give you less help. I will tell you, though, that I would use at least one array to store the names of the gifts - although you might use more if you want to do the extension task.

This is quite a bit more tricky that Ten Green Bottles. Think carefully about how the song is structured. There are twelve days, and on each day you need to mention all of the gifts you've received so far, so on the first day you mention one present, then on the second day you get the next present and are reminded of the first one, and so on. So your program needs to count up to twelve, but what else does it need to do?

Your Task

Your task is to produce a program to print the words to the song The Twelve Days of Christmas. Your program should:

  1. be efficient and use a loop - it shouldn't just PRINT the whole song

  2. correctly list all of the presents (in the correct order) so far

  3. consider how to lay out the words to make the song clear and easy to read

Extension

My daughter's year 2 Christmas homework was to work out how many presents were given altogether. Could your program work that out? You could also show the number of presents on each day so that the user can see where the total comes from.

You can use any other programming tricks you've learnt to improve the program. You could try, for example, to display the numbers of presents and the number of the day in words, rather than digits - e.g. "On the second day of Christmas my true love sent to me two turtle doves...".