-
January 7th, 2002, 07:34 PM
#1
VB 6.0 collge help
Happy new Year Everyone! I am currently a 2 year ISM major and I am having trouble answering 9 exercise questions. These questions are very short and simple but for an advance programmer but extremely difficult to me. I need help writing these simple textbook generic codes. If anyone can help me I would greatly appreciate it. I have then on file and the can be emailed for review upon request.
Thanks again,
MsTee
-
January 8th, 2002, 01:40 AM
#2
Re: VB 6.0 collge help
I'm willing to have a look
Tom Cannaerts
slisse@planetinternet.be.remove.this.bit
Moderator on http://www.vbcodelibrary.co.uk/board
A bottomless pit, I'm sure it came with the place, who would dig one on purpose?
-
January 11th, 2002, 08:32 PM
#3
Re: VB 6.0 collge help
First, let me thank you for responding so quickly. Any help you can offer will be greatly appreciated. The following are the exercises that are giving me much difficulty:
2.4 You have a form with a text box, txBox, and a command button, cmdButton1. Write instructions such that when the button is selected, the words “Button Pressed” appear in the text box.
2.5 You have a form with two text boxes, txtBox1 and txtBox2, and two command buttons, cmdButton1 and cmdButton2. Write the instructions such that when cmdButton1 is selected, the contents of txtBox1 are copied to txtBox2, and when cmdButton2 is pressed, the contents of txtBox2 are copied in txtBox1.
2.6 You have a form with two text boxes, txtBox1 and txtBox2. Write the instructions such that the text box with focus has bold text, and the text box without focus has normal (not bold) text.
2.7 You have a picture box, picOutput, and command button, cmdCompute. Write the instructions such that when cmdCompute is selected, the answer to the following problem is displayed: “If 30 people eat 45 hamburgers, how many hamburgers will 50 people eat?”
2.8 You have a form with three boxes, txtBox1, txtBox2 and txtOutput, and a command button, cmdCompute. Write instructions such that when the button is selected, the numerical values in txtBox1 and txtBox2 are multiplied together and the result is displayed in txtOutput.
2.9 You have a form with three text boxes, txtBox1, txtBox2 and txtOutput, and a command button cmdCompute. Write the instructions such that when the button is selected, the strings in tctBox1 and txtBox2 are concentrated and the results is displayed in txtOutput.
2.10 You have a form with a text box, txtBox, a label, lblOutout, and a command button, cmdbutton, cmdCompute. Write the instructions such that the user can enter a value in the text box representing an amount of money, click on the button, and then the label displays the amount of money that would be earned in three years of compound interest at 5%.
3.6 Write a program that reads three strings from a data file and displays the first three letters of each string.
4.5 You have a command button, cmdShowerLength, and two text boxes, txtInput and txtDisplay. Write code such that when cmdShowerLength is clicked, txtDisplay shows the number of characters in the txtInput. The output in txtDisplay should be produced by a call to Sub procedure named Length.
4.6 You have a command button, cmdShow, and a picture box, picOutput. Write Sub procedure, called Doubler, that takes a parameter and doubles it. Use this Sub to write code such that when cmdShow is clicked, the first four powers of 2 ( that is 2,4,8,16) are displayed in picOutput.
5.5 Write a function that takes a number of years and returns the equivalent number of months. Write another function that takes a number of years and returns the equivalent numbers of days (ignore the possibly of leap years). Combine these functions in a program that has a text box, a command button, and a picture box. When the command button is clicked, the number of years in the text box is converted to months and days and displayed in the picture box.
6.5 Suppose, in a certain country, income tax is computed as follows: 18% of income, with a minimum of $1,000. Write a program that takes an income as input and produces the tax amount as output.
6.6 Suppose the country in the previous question modifies its income tax law. People earning less than $35,000 pay the same as before, 18% with a minimum of $1,000. However, people earning $35,000 or more now pay $6,800 + 25% of the income over $35,000. Modify your previous program to account for this change.
6.7 Write a program that makes an abbreviation from the following list of computer terms, and displays the full term. Make use of the Select-Case.
CS Computer Science
CD Compact Disc
DTP Desktop Publishing
OCR Optical Character Recognition
7.7 Suppose the population of a certain country was 125,000 at the beginning of the year 1995. The population is growing at a rate of 4.3% per year. Write a program that determines in what year the population will reach or exceed 200,000.
7.8 Write a program that receives an initial amount, a percentage of yearly compound interest, and a number of years, and then computes how much money would e in the account after that number of years. Make use of a For loop in your calculations.
8.4 Write a Sub called AddTitle that takes an array of Strings as a parameter and, for each String, adds the prefix “Dr”. Use Lbound and Ubound so that your SUB works on any size array. Write a test program for your Sub that crates an array of the following strings, calls the Sub, and then displays the results.
“Kildar”, “Zhivago”, “Spocks”, “Roberts”
8.5 You have a form with a control array of four text boxes, txtInput, a command button, cmdAverage, and a label, lblAverage. Write code such that when cmdAverage is clicked, lblAverage is displays the average of the numbers in the four text boxes. Use a loop in performing the calculation.
-
January 12th, 2002, 02:43 PM
#4
Re: VB 6.0 collge help
2.4 answer:
Private Sub cmdButton1_GotFocus()
txBox.Text = "Button Pressed"
End Sub
2.5 answer:
Private Sub cmdButton1_GotFocus()
txBox2 = txBox1
End Sub
Private Sub cmdButton2_Click()
txBox1 = txBox2
End Sub
halforc
-
January 12th, 2002, 07:20 PM
#5
2.6
private Sub Text1_GotFocus()
Text2.FontBold = false
Text1.FontBold = true
End Sub
'
private Sub Text2_GotFocus()
Text1.FontBold = false
Text2.FontBold = true
End Sub
-
January 13th, 2002, 01:04 PM
#6
Re: VB 6.0 collge help
I strongly believe that this excersize should be done by the student himself.
It is not fair to answer these questions as that wouldn't help the student. These are very fundamental questions in VB and answering them should be very easy for one who had attended a week lab or went through first few chapters in any VB book.
-
January 5th, 2008, 10:04 PM
#7
Re: VB 6.0 collge help
Hi
I'VE JUST FINISHED THE ACTIVITIES BUT STUCK ON 7.7 WITH THE CODING. I CAN'T DO IT.
PLEASE CAN YOU HELP ME.
THANKS
-
January 5th, 2008, 10:11 PM
#8
Re: VB 6.0 collge help
you realize this is from 2002?
-
January 6th, 2008, 05:02 AM
#9
Re: VB 6.0 collge help
David I guess this is relevant to this thread only. Because the exercise belongs to this thread.
Zobi,
Easiest thing to do is write down the steps on the paper first and then try to write the code for the same steps.
-
January 6th, 2008, 11:51 AM
#10
Re: VB 6.0 collge help
Does Anyone Know How To Write 2.5 Billion In Vb, Its Not Working, Very Confused
-
January 6th, 2008, 12:28 PM
#11
Re: VB 6.0 collge help
Originally Posted by zobi316
Does Anyone Know How To Write 2.5 Billion In Vb, Its Not Working, Very Confused
How are you writing it? Show us the code. In case you are using integer or long then you should change it to double.
-
January 6th, 2008, 01:57 PM
#12
Re: VB 6.0 collge help
THIS IS THE THE PROGRAM ""The worlds population reached 6.2 billion people in 2002 and was growing at rate 1.2 percent each year. Assuming the population will continue to grow at the same rate, write a program to determine when the population will exceed 10 billion.
NOT SURE IF THE CODES RIGHT BUT I'M TRYING TO SOLVE IT. PLEASE CHECK
Dim population As Double, quantity As Integer
Dim perform As Integer
Dim message As String
Do
population = InputBox("What is the population?", "Population")
If (population > 6.5) Then
Do
perform = "6.5 * 2400"
message = PMESSAGE & Format(population, "currency")
quantity = CInt(InputBox(message, "Enter population after 6.5 billion"))
If (population >= 6.5) Then
Loop Until (population > 6.5)
End If
picOutput.Print (overall population)."
picOutput.Print "Total population: "; Format(population, "Currency")
Loop
End Sub
-
January 6th, 2008, 03:58 PM
#13
Re: VB 6.0 collge help
Look at your code, The do loops are not valid and what is the need of If condition?
Important Steps to note are these:
1. CurrentPopulation will be added by 1.2% and year will be incremented by 1.
There is no need of Inputbox. Just write a loop that will calculate what the population should be each year and then show the year when the population is greater than 10 Billion. My guess would be somewhere around 2043 so that should be your answer.
-
January 6th, 2008, 05:44 PM
#14
Re: VB 6.0 collge help
HOPE ITS RIGHT NOW, TOOK ME QUITE LENGTH OF TIME
Dim Population As Single
Dim growthRate As Single
Population = 6.2
growthRate = 1.2
Population = Population + (Population * growthRate)
Do
Loop Until (Population > 1000000000)
lstName.AddItem Now & message
-
January 6th, 2008, 05:53 PM
#15
Re: VB 6.0 collge help
Missed a few things, including zero's and the year!
Code:
Option Explicit
Private Sub Form_Load()
Dim Population As Single
Dim growthRate As Single
Dim Year As Single
Population = 6.2
growthRate = 0.012
Year = 2002
Do
Population = Population + (Population * growthRate)
Year = Year + 1
Loop Until (Population > 10)
MsgBox (Int(Population) & " Billion in year: " & Year)
End Sub
btw - where is this used for? got a link?
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
|