Explore BrainMass
Share

# The Twelve Days of Christmas Program

Here is the problem. The Twelve Days of Christmas. Each year, PNC Advisors of Pittsburgh publishes a Christmas Price List. See Table 6.11. Write a program that requests am integer from 1 through 12 and then lists the gifts for that day along with the day's cost. On the nth, day, the n gifts are 1 partridge in a pear tree, 2 turtle doves,...., n of the nth item. The program also should give the total cost of all twelve days. As an example, the output in the list box when the user enters 3 is shown below.

Christmas Price List for 2001
Item Cost Item Cost
partridge in a pear tree 140.00 swan-a-swimming 500.00
turtle dove 29.00 maid-a-milking 5.15
French hen 5.00 lady dancing 446.58
calling bird 79.00 lord-a-leaping 377.06
gold ring 75.00 piper piping 146.78
geese-a-laying 25.00 drummer drumming 145.76

The gifts for day 3 are
1 partridge in a pear tree
2 turtle doves
3 french hens
Cost \$213.00
Total Cost for the twelve days : \$62,934.96

#### Solution Summary

This solution provides a Java file that consists of a program that requests am integer from 1 through 12 and then lists the gifts for that day along with the day's cost.

\$2.19