Create a program requests an integer


Discuss the below:

Q: The Twelve Days of Christmas. Each year, PNC Advisors of Pittsburgh publishes a Christmas Price List. Create a program that requests an 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 Preview :

Prepared by a verified Expert
JAVA Programming: Create a program requests an integer
Reference No:- TGS01935301

Now Priced at $25 (50% Discount)

Recommended (99%)

Rated (4.3/5)