-
December 8th, 2008, 12:27 PM
#1
Question on code
I have some questions I have a answer for a college test and need some help on a couple I am stuck on.
#1 Write code that declares a string array with three elements, and then stores your first, middle, and last name in the arrays elements.
#2 Write a Do While loop that uses an input box to get a number from the user. The number should be mulitplied by 10 and the result stored in the variable product. The loop should iterate as long as product contains a value less than 100. Use intNumber and intProduct.
Please help me write this code. Thank you
-
December 8th, 2008, 12:40 PM
#2
Re: Question on code
1) Update your profile to enable prive messageing and viewing of signatures.
2) Read the link in my signature regarding homework.
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 8th, 2008, 12:48 PM
#3
Re: Question on code
I am just needing help. Im not here to argue with anyone and im not trying to cheat anyone. I'm not even wanting to become a programmer it was just required course that I had to take but dont really need. Thanks and any help would be great.
-
December 8th, 2008, 01:02 PM
#4
Re: Question on code
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 8th, 2008, 01:16 PM
#5
Re: Question on code
ok I will post what I have and see if you think it is ok. If you dont mind.
#1. Write a Do While loop that uses an input box to get a number from the user. The number should be mulitplied by 10 and the result stored in the variable product. The loop should iterate as long as product contains a value less than 100. Use intNumber and intProduct.
#1 Answer
Dim names(2) As String
names (0) = "Jamie"
names(1) = "Andrew"
names(2) = "Foster"
#2. Suppose you need to store information about 12 countries. Declare two arrays that may be used in parallel to store the names of the countries and there populations. Use the underlined words for any array names.
#2 Answer
Dim strCountries (11) As String
Dim strPopulations (11) As String
For intCount 0 to 4
lstCountry.Items.Add(“Country: “ strCountries(intCount) “ Population: “ strPopulation(intCount))
#3. An event procedure named btnShow_Click must add numbers 1 through 20 to a list box named 1stNumbers. Write the code.
#3 Answer
1stNumbers.items.add (intCount)
Next intCount
#4. Write a Do While loop that uses an input box to get a number from the user. The number should be mulitplied by 10 and the result stored in the variable product. The loop should iterate as long as product contains a value less than 100. Use intNumber and intProduct.
#4. Answer
Dim intNumber As Integer
Dim intProduct As Integer
Do
intNumber = CInt(InputBox("Enter A Number"))
intProduct = intNumber * 10
Loop While intProduct < 100
Look ok??? please help and thank you
-
December 8th, 2008, 01:25 PM
#6
-
December 8th, 2008, 01:29 PM
#7
Re: Question on code
Sorry, question #1 should be
Write code that declares a string array with three elements, and then store your first, middle, and last name in the arrays elements.
Answer
Dim names(2) As String
names (0) = "Jamie"
names(1) = "Andrew"
names(2) = "Foster"
-
December 8th, 2008, 01:32 PM
#8
Re: Question on code
#1 and #4 seem correct to me. Could you clarify your answers on #2 and #3?
-
December 8th, 2008, 01:57 PM
#9
Re: Question on code
Code:
lstCountry.Items.Add(“Country: “ strCountries(intCount) “ Population: “ strPopulation(intCount))
Does that COMPILE????
TheCPUWizard is a registered trademark, all rights reserved. (If this post was helpful, please RATE it!)
2008, 2009,2010
In theory, there is no difference between theory and practice; in practice there is.
* Join the fight, refuse to respond to posts that contain code outside of [code] ... [/code] tags. See here for instructions
* How NOT to post a question here
* Of course you read this carefully before you posted
* Need homework help? Read this first
-
December 8th, 2008, 06:55 PM
#10
Re: Question on code
It will help you greatly if you TYPE THE CODE IN YOURSELF, and then press the F5 key, to see the output (if it compiles)
It looks like you skimmed the back of chapter 3 expecting to pick up on 6 weeks worth of courses.
I wish someone would do that for me, so I can take a long vacation...
-
December 9th, 2008, 08:28 AM
#11
Re: Question on code
It looks like numbers two and three are merged together:
the for-loop of #2 surely must have its own Next statement, as well as the #3 loop must get its own for-statement.
Also check on the syntax of the for-loop. It is nearly correct. Only one character missing.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|