Option Explicit
Private Sub cmdCalculate_Click()
Const dblTax As Double = 0.82
Dim dblHours As Double
Dim dblOvertimeHours As Double
Dim dblRate As Double
Dim dblAnswer As Double
dblHours = txtHours.Text 'Get user input for hours
dblRate = txtRate.Text 'Get user input for rate
dblAnswer = dblHours * dblRate
dblOvertimeHours = dblHours - 40
If dblHours > 40 And optNo.Value = True Then
lblWageTotal.Caption = ((dblHours * dblRate) + (dblOvertimeHours * (dblRate * 0.5))) * dblTax
ElseIf dblHours < 40 And optNo.Value = True Then
lblWageTotal.Caption = (dblHours * dblRate) * dblTax
ElseIf dblHours > 40 And optYes.Value = True Then
lblWageTotal.Caption = (dblHours * dblRate) + (dblOvertimeHours * (dblRate * 0.5))
ElseIf dblHours < 40 And optYes.Value = True Then
lblWageTotal.Caption = dblHours * dblRate
End If
End Sub
Private Sub cmdDone_Click()
Unload Me
End Sub
Private Sub txtHours_Change()
lblWageTotal.Caption = "" 'Clear lblWageTotal when new hours are input
End Sub
Private Sub txtRate_Change()
lblWageTotal.Caption = "" 'Clear lblWageTotal when new hours are input
End Sub