12 Days of christmas VB Pogram help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • mexicandayworker
    New Member
    • Dec 2007
    • 1

    12 Days of christmas VB Pogram help

    I have this problem I have to program with vb2005.

    Write a program to calculate the 12 days of christmas. The program requests an integer from 1 to 12 and then lists the gifts for that day along with the cost. The program should also give the costs for all 12 days ($72,608.00). If bad data is supplied the program should display a message box to the user and NOT perform any calculations. If the data is good the calculations should be performed and the appropriate costs should be displayed.

    The days and costs are as follows:
    1 Partridge in a pear tree - $104.99
    2 Turtle doves - $20.00 * 2
    3 French hens - $15.00 * 3
    4 Calling birds - $99.99 * 4
    5 Golden rings - $65.00 *5
    6 Geese a-laying - $50.00 * 6
    7 Swans a-swimming - $600.00 * 7
    8 Maids a-milking - $5.15 * 8
    9 Ladies dancing - $508.46 * 9
    10 Lords a-leaping * 403.91 * 10
    11 Pipers piping - 186.65 * 11
    12 Drummers drumming - 185.36 * 12
    Cost for day is: X
    Total cost for 12 days is : $72,608.00

    Program MUST contain loops or arrays.


    THANKS IN ADVANCE FOR YOUR HELP!!!!!
    Last edited by Killer42; Dec 18 '07, 08:05 AM.
  • halo combat22
    New Member
    • Oct 2007
    • 24

    #2
    You could create an Array of 12, and get your input and display the what the Array holds at that value.
    Like so...
    Code:
    Dim arnDays(12) as String
    'You now need to fill the array
    arnDays(1) =" Partridge in a pear tree  104.99"
    arnDays(2) =" 2 Turtle doves " & Val($20.00 * 2)
    and so on...
    now all you need to do is output it.

    Comment

    • Killer42
      Recognized Expert Expert
      • Oct 2006
      • 8429

      #3
      The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

      Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

      Then when you are ready post a new question in this thread.

      MODERATOR

      Comment

      • genta
        New Member
        • Jan 2008
        • 1

        #4
        Originally posted by halo combat22
        You could create an Array of 12, and get your input and display the what the Array holds at that value.
        Like so...
        Code:
        Dim arnDays(12) as String
        'You now need to fill the array
        arnDays(1) =" Partridge in a pear tree  104.99"
        arnDays(2) =" 2 Turtle doves " & Val($20.00 * 2)
        and so on...
        now all you need to do is output it.
        CAN YOU HELP ME WITH THIS IT'S A LITTLE BIT DIFFERENT...i'm a beginner in VB... PLZZZZZZZZZZZZ

        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 s wan-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

        Comment

        • Killer42
          Recognized Expert Expert
          • Oct 2006
          • 8429

          #5
          At the risk of repeating myself...

          The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

          Please read the Posting Guidelines and particularly the Coursework Posting Guidelines.

          Then when you are ready post a new question in this thread.

          MODERATOR

          Comment

          Working...