I need a little help finishing a Visual Basic .Net Project

XBoxLPU

Diamond Member
Aug 21, 2001
4,249
1
0
It is a program calcuating employee yearly raises.

The different percentage rates are different for the three different job positions which are sales(8%), management(5%), and labor(10%). If you have been there for more then 15 years you get an additonal 2%.

I have got the program working for the three different positions but I do not know how to add the additional 2% for the 15 years or more

The teacher has not taught us to use if else then statements or selectcase ( next chapter ).I am assuming she wants us to use the global variables to keep track of everything but I am lost. And I am not finding anything on the net or in my book dealing with this situation

Thanks

http://www.dswann.com/vb.jpg
 

five40

Golden Member
Oct 4, 2004
1,875
0
0
Private Sub WHATEVERYOURINCREASEBY.2BUTTON IS (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radlabor.CheckedChanged
rate = rate + 0.2
End Sub
 

Digobick

Platinum Member
Oct 9, 1999
2,467
0
76
Originally posted by: five40
Private Sub WHATEVERYOURINCREASEBY.2BUTTON IS (ByVal sender As System.Object, ByVal e As System.EventArgs) Handles radlabor.CheckedChanged
rate = rate + 0.2
End Sub
Or, since you're using .NET, you can shorten this to:
 

Digobick

Platinum Member
Oct 9, 1999
2,467
0
76
But the way your code is setup, you'll have to be careful about what order you check the the checkboxes. If you Check the 15 Year box first, this will add 0.02 to whatever the current rate is. Then, if you check another checkbox it will override the rate to something else, when it should be adding to the 0.02 that's already there.
 

XZeroII

Lifer
Jun 30, 2001
12,572
0
0
Originally posted by: XBoxLPU
D'oh. Thanks for the help guys

Digobick, any other way to setup the code?

without using If Then's, I dont' think so.

If you want to get technical, you can use the IIf function.