By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,988 Members | 1,476 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,988 IT Pros & Developers. It's quick & easy.

12 Days of christmas VB Pogram help

P: 1
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!!!!!
Dec 7 '07 #1
Share this Question
Share on Google+
4 Replies


P: 24
You could create an Array of 12, and get your input and display the what the Array holds at that value.
Like so...
Expand|Select|Wrap|Line Numbers
  1. Dim arnDays(12) as String
  2. 'You now need to fill the array
  3. arnDays(1) =" Partridge in a pear tree  104.99"
  4. arnDays(2) =" 2 Turtle doves " & Val($20.00 * 2)
  5. and so on...
  6. now all you need to do is output it.
  7.  
Dec 17 '07 #2

Expert 5K+
P: 8,434
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
Dec 18 '07 #3

P: 1
You could create an Array of 12, and get your input and display the what the Array holds at that value.
Like so...
Expand|Select|Wrap|Line Numbers
  1. Dim arnDays(12) as String
  2. 'You now need to fill the array
  3. arnDays(1) =" Partridge in a pear tree  104.99"
  4. arnDays(2) =" 2 Turtle doves " & Val($20.00 * 2)
  5. and so on...
  6. now all you need to do is output it.
  7.  
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
Jan 7 '08 #4

Expert 5K+
P: 8,434
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
Jan 8 '08 #5

Post your reply

Sign in to post your reply or Sign up for a free account.