10 year pay caculator (calculation problem)-VBForums

# Thread: 10 year pay caculator (calculation problem)

1. ## 10 year pay caculator (calculation problem)

Dim decwage As Decimal
Dim decraise As Decimal
Dim decWagePerYear As Decimal

For intYear As Integer = 1 To 10

If Decimal.TryParse(txtHourlyWage.Text, decwage) AndAlso Decimal.TryParse(txtRaise.Text, decraise) Then
decWagePerYear += decwage * 2080
decwage *= (decraise / 100)
LstYearPay.Items.Add(" Year " & intYear & " Annual Salary " & decWagePerYear)
End If
Next

I'm trying to get this code to add the difference in pay for the next 10 years. Unfortunately it is taking the percent and multiplying that by the pay for the year. Can anyone help me with what I'm doing wrong.

2. ## Re: 10 year pay caculator (calculation problem)

the first problem i can see is your loop is in the wrong place:

vb.net Code:
`Dim decwage As DecimalDim decraise As DecimalDim decWagePerYear As Decimal If Decimal.TryParse(txtHourlyWage.Text, decwage) AndAlso Decimal.TryParse(txtRaise.Text, decraise) Then    For intYear As Integer = 1 To 10        decWagePerYear += decwage * 2080        decwage *= (decraise / 100)        LstYearPay.Items.Add(" Year " & intYear & " Annual Salary " & decWagePerYear)    NextEnd If`

3. ## Re: 10 year pay caculator (calculation problem)

Thanks for that. Now that I have corrected the place of the loop, when I hit the calculate button I get all sorts of crazy numbers is the way I setting up the calculations not acceptable?

#### Posting Permissions

• You may not post new threads
• You may not post replies
• You may not post attachments
• You may not edit your posts
•