Public Class frmpay Private Sub btnpay_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnpay.Click Dim id As Integer Dim first, last As String Dim rate As Double Dim hours As Double Dim gross As Double Dim num As Double Dim overtime As Double Dim OT As Double Dim deduct As Double Dim dedgross As Double Dim net As Double Dim tax As Double id = txtnum.Text first = txtfirst.Text last = txtlast.Text rate = txtrate.Text hours = txthours.Text num = getA() overtime = getOt() OT = calcOT(overtime, rate, hours, gross) gross = OT deduct = calcded(gross) dedgross = getT(gross, deduct) net = calcNet(dedgross) tax = calcTax(dedgross) If id <= 0 Then MsgBox("The id number has to be greater then 0", , "Not a valid ID number") Else lstpay.Items.Add("PAYSTUB:") lstpay.Items.Add(" Employee Number: " & id) lstpay.Items.Add(" Last Name: " & last) lstpay.Items.Add(" First Name: " & first) lstpay.Items.Add(" Dept Number: " & num) lstpay.Items.Add(" OT Code: " & overtime) lstpay.Items.Add(" Hourly Rate: " & FormatCurrency(rate)) lstpay.Items.Add("") lstpay.Items.Add(" Hours Worked: " & hours) lstpay.Items.Add(" Gross Pay: " & FormatCurrency(gross)) lstpay.Items.Add(" Deductions: " & FormatCurrency(deduct)) lstpay.Items.Add(" Tax: " & FormatCurrency(tax)) lstpay.Items.Add(" Net Pay: " & FormatCurrency(net)) lstpay.Items.Add("") lstpay.Items.Add("PAYCHECK:") lstpay.Items.Add(" Pay to the order of " & first & " " & last) lstpay.Items.Add(" the amount of " & FormatCurrency(net)) End If End Sub Function calctax(ByVal dedgross As Double) As Double Dim tax As Double If dedgross <= 100 Then Return dedgross ElseIf dedgross > 100 And dedgross < 200 Then Tax = (dedgross * 0.1) Return Tax ElseIf dedgross > 200 And dedgross < 300 Then Tax = (dedgross * 0.15) Return Tax ElseIf dedgross > 300 And dedgross < 600 Then Tax = (dedgross * 0.25) Return Tax ElseIf dedgross > 600 Then tax = (dedgross * 0.35) Return tax End If End Function Function calcNet(ByVal dedgross As Double) As Double Dim net As Double If dedgross <= 100 Then Return dedgross ElseIf dedgross > 100 And dedgross < 200 Then net = dedgross - (dedgross * 0.1) Return net ElseIf dedgross > 200 And dedgross < 300 Then net = dedgross - (dedgross * 0.15) Return net ElseIf dedgross > 300 And dedgross < 600 Then net = dedgross - (dedgross * 0.25) Return net ElseIf dedgross > 600 Then net = dedgross - (dedgross * 0.35) Return net End If End Function Function getT(ByVal gross As Double, ByVal deduct As Double) As Double Dim dedgross As Double dedgross = gross - deduct Return dedgross End Function Function calcded(ByVal gross As Double) As Double Dim deduct As Double deduct = gross * 0.153 Return deduct End Function Function getOt() As Double Dim OT As Double OT = Val(Me.txtovertime.Text) Return OT End Function Function calcOT(ByVal overtime As Double, ByVal rate As Double, ByVal hours As Double, ByVal gross As Double) As Double If overtime = 1 Then gross = (rate + (rate / 2)) * hours ElseIf overtime > 4 Then MsgBox("Not a valid overtime code") Else gross = hours * rate End If Return gross End Function Function getA() As Double Dim dept As Double dept = Val(Me.txtdept.Text) Return dept End Function Private Sub btnnext_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnnext.Click txtnum.Clear() txtrate.Clear() txtfirst.Clear() txtlast.Clear() txthours.Clear() txtrate.Clear() txtovertime.Clear() txtdept.Clear() lstpay.Items.Clear() End Sub Private Sub btnexit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnexit.Click Close() End Sub End Class