473,671 Members | 2,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

12 Days of christmas VB Pogram help

1 New Member
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
4 4017
halo combat22
24 New Member
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
Killer42
8,435 Recognized Expert Expert
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
genta
1 New Member
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
Killer42
8,435 Recognized Expert Expert
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

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

Similar topics

14
1984
by: Brian | last post by:
I have been using lcc-win32 but need to switch over to intel for SIMD/SSE2 stuff. The documentation is pretty limited. It does not say much about the linker other than the fact that you can create a dll. But it doesn't say anything about being able to specify a .def file to specify exported functions, and it doesn't say whether or not you can prevent underlines from being prepended to the function name. Also, it does not say anything about...
12
23765
by: Anthony Robinson | last post by:
Is anyone aware of a function (system or user defined) that will calculate business days? For instance: I have a column in as table called DATE. I want to be able to add five business days to that date and come up with a new date. Is that possible. Also, is there anyway that DB2 can be aware of holidays? Maybe load them onto the server in some type of reference file or something. I ask these questions because I'm working on a banking...
4
6153
by: CDMAPoster | last post by:
I'm starting to come up with a version of DateAdd that I call BusinessDateAdd that adds the selected number of business days. It's still in preliminary form (needs testing) and interacts with my direct date functions (which have also changed slightly). There's no room to put the code in the margins :-), but there's enough room to put up a few URL's. The zip file is a zipped A97 mdb file with a single module. Zipped: ...
4
9795
by: viperman5000 | last post by:
Using for loops, how would you generate a Christmas Tree using *'s. Also, the size depends on the user's input (size). Any help would be greatly appreciated, as my grade depends on it.
8
7502
by: =?Utf-8?B?QWw=?= | last post by:
I am working in vb2005. how can I calculate business days (not including holidays and weekends) between 2 dates? thanks Al
6
3532
by: W. eWatson | last post by:
That's the question in Subject. For example, the difference between 08/29/2008 and 09/03/2008 is +5. The difference between 02/28/2008 and 03/03/2008 is 4, leap year--extra day in Feb. I'm really only interested in years between, say, 1990 and 2050. In other words not some really strange period of time well outside our current era of history. -- W. eWatson (121.015 Deg. W, 39.262 Deg. N) GMT-8 hr std. time)
0
1663
by: Now You Know | last post by:
Best Christmas Lights Decoration Sale Installation in Los Angeles 818-386-1022 (These types of Innovative lights will definetly add to your Christmas decor) Here are the tips to use: The most common color combinations appropriate for the Christmas season include red, green and copper lights that denote festivity; blue and green lights for more subdued arrangements; novelty combinations such as blue and red lights; and mauve, blue and...
0
2343
by: Now You Know | last post by:
Best Christmas Lights Decoration Sale Installation in Los Angeles 818-386-1022 (These types of Innovative lights will definetly add to your Christmas decor) Here are the tips to use: The most common color combinations appropriate for the Christmas season include red, green and copper lights that denote festivity; blue and green lights for more subdued arrangements; novelty combinations such as blue and red lights; and mauve, blue and...
0
8474
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8912
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8597
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7428
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6222
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4403
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2809
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2049
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1807
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.