The Twelve Days of Christmas. Each year, Provident National Bank of Philadelphia
publishes a Christmas price list. See Table 5.8. Write a program that
requests an integer from 1 through 12 and then lists the gifts for that day along
with that 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, Figure 5-17 shows the output in the picture
box when the user enters 3.
TABLE 5.8
Christmas Price Index
Item Cost Item Cost
partridge in a pear tree 27.50 swan-a-swimming 1000.00
turtle dove 25.00 maid-a-milking 4.25
French hen 5.00 lady dancing 289.50
calling bird 70.00 lord-a-leaping 292.50
gold ring 60.00 piper piping 95.75
geese-a-laying 25.00 drummer drumming 95.00
The gifts for day 3 are
1 partridge in a pear tree
2 turtle doves
3 French hens
Cost: $92.50
Total cost for the twelve days: $71,613.50
FIGURE 5-17 Sample Output for Programming Project 8
P r o g r a m m i n g P r o j e c t s 157
THANKS IN ADVANCE !!!


