JCasey
April 8th, 2001, 08:09 AM
I have two problems I have been working on since 10am Sat. The first is an input file problem where you have to find the highest and lowest bid using an if statement. I can get the highest bid by using If bids > highestbid then highestbid =bid and feel the next part should be an ElseIf but can't get the lowest to come up.
This one looking for input from user, name age and current salar and determine how much money they will make by age 65. I don't even know if I'm on the right track. As it goes through the for yrs 1 to 65 doesn't it have to save each result somewhere to calculate totalEarnings. I'm so confused and teacher hasn't responded to email. Please help.
Private Sub CmdCalculate_Click()
' input employee name, age and current salary
' cmdCalculate will calculate salary at the age of
' 65 given a 5% increase each year.
Dim name As String, age As Single, salary As Single
Dim yrs As Single, rate As Single, wageIncrease As Single
Dim IncreasedSalary As Single, Increase As Single, totalSalary As Single
name = txtName.Text 'name of employee
age = Val(TxtAge.Text) 'current age of employee
salary = Val(txtSalary.Text) 'current salary of employee
yrs = 0 'difference from age to 65
rate = 0.05 'yearly salary increase
wageIncrease = 0 '5% increase * salary
IncreasedSalary = 0 'WageIncrease + salary
picDisplay.Cls
wageIncrease = rate * salary + salary
yrs = 65 - age
Increase = wageIncrease * rate
IncreasedSalary = wageIncrease
For yrs = 1 To 65
IncreasedSalary = wageIncrease * rate + IncreasedSalary
totalSalary = IncreasedSalary
Next yrs
picDisplay.Print name; " "; "will earn about"; FormatCurrency(totalSalary, 0)
End Sub
This one looking for input from user, name age and current salar and determine how much money they will make by age 65. I don't even know if I'm on the right track. As it goes through the for yrs 1 to 65 doesn't it have to save each result somewhere to calculate totalEarnings. I'm so confused and teacher hasn't responded to email. Please help.
Private Sub CmdCalculate_Click()
' input employee name, age and current salary
' cmdCalculate will calculate salary at the age of
' 65 given a 5% increase each year.
Dim name As String, age As Single, salary As Single
Dim yrs As Single, rate As Single, wageIncrease As Single
Dim IncreasedSalary As Single, Increase As Single, totalSalary As Single
name = txtName.Text 'name of employee
age = Val(TxtAge.Text) 'current age of employee
salary = Val(txtSalary.Text) 'current salary of employee
yrs = 0 'difference from age to 65
rate = 0.05 'yearly salary increase
wageIncrease = 0 '5% increase * salary
IncreasedSalary = 0 'WageIncrease + salary
picDisplay.Cls
wageIncrease = rate * salary + salary
yrs = 65 - age
Increase = wageIncrease * rate
IncreasedSalary = wageIncrease
For yrs = 1 To 65
IncreasedSalary = wageIncrease * rate + IncreasedSalary
totalSalary = IncreasedSalary
Next yrs
picDisplay.Print name; " "; "will earn about"; FormatCurrency(totalSalary, 0)
End Sub