Public Class Form1
Private Sub exitButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles exitButton.Click
Me.Close()
End Sub
Private Sub clearButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles clearButton.Click
HourlyRateTextBox.Clear()
HoursWorkedTextBox.Clear()
GrossPayTextBox.Clear()
End Sub
Private Sub CalculateGrossPay(ByVal hourlyrate As Decimal, _
ByVal hoursworked As Decimal, _
ByVal salaried As Decimal, _
ByRef grosspay As Decimal)
For index As Integer = 1 To grosspay
Next
grosspay = hourlyrate * hoursworked
If hoursworked > 40 Then
grosspay = hoursworked * hourlyrate _
+ (hoursworked - 40) * hourlyrate * 0.5
End If
End Sub
'Private Function GrossPay(ByVal hourlyrate As Decimal,
' ByVal hoursworked As Decimal,
' ByVal salaried As Decimal) _
' As Decimal
' For i As Integer = 1 To salaried
' GrossPay = hoursworked * hourlyrate
' Next
' If hoursworked > 40 Then
' GrossPay = hoursworked * hourlyrate _
' + (hoursworked - 40) * hourlyrate * 0.5
' End If
' Return GrossPay
'End Function
Private Sub ProcedureButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles ProcedureButton.Click
Dim hourlyrate As Decimal = CDec(HourlyRateTextBox.Text)
Dim hoursworked As Decimal = CDec(HoursWorkedTextBox.Text)
Dim grosspay As Decimal
Dim salaried As Decimal
Me.CalculateGrossPay(hourlyrate, hoursworked, salaried, grosspay)
GrossPayTextBox.Text = FormatCurrency(grosspay)
GrossPayTextBox.Select()
End Sub
Private Sub FunctionButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles FunctionButton.Click
Dim hourlyrate As Decimal
Dim grosspay As Decimal
If SalariedCheckBox.Checked Then
grosspay = hourlyrate * 40
End If
End Sub
Private Function Salary() As Boolean
Dim grosspay As Decimal
Dim hourlyrate As Decimal
If SalariedCheckBox.Checked Then
grosspay = hourlyrate * 40
End If
Salary = True
End Function
End Class
I am creating a program that creates a function and a sub procedure that computes gross pay. Now I am trying to get a salaried checkbox to be a boolean value so it can idicate whether the employee salaried (true) or not (false). This is what I have so far but it is not working. Then I have to put it in the function button and procedure button so I can calculate it. If the employee is salaried - the gross pay is simply 40 times the hourly rate no matter how many hours are working in the week. Any suggestions?

New Topic/Question
Reply



MultiQuote









|