-
Jan 25th, 2011, 04:00 PM
#1
Thread Starter
Member
Help with a Pay Calculator
i have two texts boxes where the user can enter pay per hour and expected raise % per year.
when the calculate button is clicked it calculates yearly base on a 40 hour and 52 week base. the raise increases each amount after the first year and does it for the next ten years. yearly amount is displayed for the next ten years.
I need some help getting this going!! Thanks
-
Jan 25th, 2011, 04:23 PM
#2
Re: Help with a Pay Calculator
Post what you have so far. We can help you out when we see where specifically you're having problems.
-
Jan 25th, 2011, 04:39 PM
#3
Thread Starter
Member
Re: Help with a Pay Calculator
im not sure how to do the interest part for the next ten years. I have a textbox where they can enter interest.
Dim PerHour As Decimal
PerHour = Decimal.Parse(PerHrTextBox.Text)
If Decimal.Parse(PerHrTextBox.Text) > 0 Then 'Successful Conversion
PerYrTextBox.Text = (PerHour * 40) * 52
End If
-
Jan 25th, 2011, 05:03 PM
#4
Re: Help with a Pay Calculator
Ok, well, make three variable to hold our calculated total, raise percent and current per-hour wage:
Code:
Dim total As Decimal
Dim currentPerHour As Decimal
Dim raise As Decimal
Next, set the currentPerHour = your initial value. Decimal.Parse is a good way to do it, but Decimal.TryParse is even better, lets set both the currentPerHour and the raise amount:
Code:
If Decimal.TryParse(PerHrTextBox.Text, currentPerHour) AndAlso Decimal.TryParse(RaiseTextBox.Text, raise) Then
Now, add the first years wages to your total:
Code:
total += currentPerHour * 2080
Next, increase the currentPerHour by the % raise (we want to add 1 because our raise is a percent in addition to 100% of the pay) :
Code:
currentPerHour *= (1 + raise)
Now, we need to repeat these two commands, so enclose them both in a loop; for 10 years, I need to loop 10 times:
Code:
For i As Integer = 1 To 10
..
..
Next
Finally, display your result:
Code:
MessageBox.Show(String.Format("The result is: {0}", total))
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
|