The Twelve Days of Christmas

 (Not rated)
 (Not rated)

The problem is as follows: 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 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.Show the output in a list box. The Christmas price list is below and should be copied and pasted into a text document and saved as 6-PP-8.TXT. The sequential file should be stored under the “Debug” subfolder of your project solution. Also, ensure that you read the file only when needed. • Use the openfiledialog control to obtain the filename. Place a button on the form to get the filename. • Include a Calculate button the will display the output requested. • Read the items and costs from an external file. In this project, read the file in the Calculate click event. This file can be read multiple times. • Include a text box that accepts as input the values 1 through 12, inclusive. Validate the data and ensure that the input is correct. If the input is incorrect, the user should be forced to correct the value in the textbox on the form. DO NOT use a masked textbox on the form and DO NOT display an input box to accept a new input entry, the user must use the original input textbox on the form. • Include a Clear button that will clear all of the fields on the screen. The focus should be set to the appropriate control afterwards. • Include an Exit button that closes the application. Label the button “Exit Program”. • Make sure that you use sub procedures/functions as described in class. To obtain the filename of the sequential file, use an OpenFileDialog control. This will entail having a control button that the user clicks to obtain the filename of the input prices. The user of the application can then enter the filename at program execution time. Ensure that you use the proper procedure type (subprocedure or function), correct ByVal or ByRef, and only what is necessary. Break your functions into as many small modules (procedures) as possible! Each event handler should have only declarations and calls to sub procedures or functions in it. Also, each sub procedure/function should do one and only one task. You may read the subquential file only as many times as needed. Remember to always convert values appropriately. You will be primarily learning and focusing on how to use loop functions, with the available options of any Do Until, Do Loopwhile, For varname=startvalue to end value Next and may use any increments. TABLE 6.11 Christmas price list for 2010 Item Cost Partridge in a pear tree 164.99 swan-a-swimming 600.00 Turtle dove 20.00 maid-a-milking 5.85 French hen 15.00 lady dancing 528.80 Calling bird 149.99 lord-a-leaping 428.51 Gold ring 79.00 piper piping 201.22 Goose-a-laying 60.00 drummer drumming 199.82 The gifts for day 3 are: 1 partridge in a pear tree 2 turtle doves 3 French hens Cost : $249.99 Total cost for the twelve days:$78,100.30 FIGURE 6.23 Sample output for Programming Project. NOTE: The total cost for the 12 days is the sum of the daily costs for each day, assuming you would purchase all items for each of the twelve days. 6-PP-8.TXT file (only include directly below) partridge in a pear tree 164.99 turtle doves 20 French hens 15 calling birds 149.99 gold rings 79 geese-a-laying 60 swans-a-swimming 600 maids-a-milking 5.85 ladies dancing 528.80 lords-a-leaping 428.51 pipers piping 201.22 drummers drumming 199.82

    • 8 years ago

    Purchase the answer to view it

    • attachment