Public Class Form1 Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click '"total up the number of hours and calculate the pay" 'Step0. Declarations Dim mon, tue, wed, thu, fri, x, y, payrate As Double 'Step1. Input mon = InputMon() tue = InputTue() wed = InputWed() thu = InputThur() fri = InputFri() payrate = Inputrate() 'Step2. Process x = payhour(mon, tue, wed, thu, fri) y = payamount(mon, tue, wed, thu, fri, x, payrate) 'Step3. Output Outputreg(x, y) End Sub Function InputMon() 'Gets the value of Monday Dim x As Double = TMon.Text Return Val(x) End Function Function InputTue() 'Gets the value of Tuesday Dim x As Double = TTues.Text Return Val(x) End Function Function InputWed() ' Gets the value of Wednesday Dim x As Double = TWed.Text Return Val(x) End Function Function InputThur() ' Gets the value of Thursday Dim x As Double = TThur.Text Return Val(x) End Function Function InputFri() ' Gets the value of Friday Dim x As Double = TFri.Text Return Val(x) End Function Function Inputrate() Dim x As Double = TRate.Text Return Val(x) End Function Function payhour(ByVal mon As Double, ByVal tue As Double, ByVal wed As Double, ByVal thu As Double, ByVal fri As Double) 'total up the number of hours and calculate the pay Dim x As Double x = Val(mon) + Val(tue) + Val(wed) + Val(thu) + Val(fri) Return x End Function Function payamount(ByVal mon As Double, ByVal tue As Double, ByVal wed As Double, ByVal thu As Double, ByVal fri As Double, ByVal x As Double, ByVal payrate As Double) 'Calculates pay Dim amount As Double If x >= 40 Then amount = ((x - 40) * 1.5 * payrate) + (40 * payrate) Else amount = payrate * x End If Return amount End Function Sub outputreg(ByVal x As Double, ByVal y As Double) 'Outputs pay With LOutput.Items .Add("The total numbers of hours worked is " & x) .Add("The total pay you get is " & y) End With End Sub Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click '"if the number of hours worked on Monday was zero, then adds eight (8) paid hours for Monday " 'Step0. Declarations Dim mon, tue, wed, thu, fri, x, y, payrate As Double 'Step1. Input mon = InputMon() tue = InputTue() wed = InputWed() thu = InputThur() fri = InputFri() payrate = Inputrate() 'Step2. Process mon = checkmon(mon) x = payhour(mon, tue, wed, thu, fri) y = payamount(mon, tue, wed, thu, fri, x, payrate) 'Step3. Output outputreg(x, y) End Sub Function checkmon(ByVal mon As Double) 'Checks if any hours was worked on monday and if not, adds 8 hours If mon = 0 Then mon = +8 End If Return Val(mon) End Function Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click 'Adds two hours for tues is worked on election night 'Step0. Declarations Dim mon, tue, wed, thu, fri, x, y, payrate As Double 'Step1. Input mon = InputMon() tue = InputTue() wed = InputWed() thu = InputThur() fri = InputFri() payrate = Inputrate() 'Step2. Process tue = checktue(tue) x = payhour(mon, tue, wed, thu, fri) y = payamount(mon, tue, wed, thu, fri, x, payrate) 'Step3. Output outputreg(x, y) End Sub Function checktue(ByVal tue As Double) 'If any hours worked on tues, then adds 2 hours If tue > 0 Then tue = +2 End If Return tue End Function Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click 'Step0. Declarations Dim mon, tue, wed, thu, fri, x, y, payrate As Double 'Step1. Input mon = InputMon() tue = InputTue() wed = InputWed() thu = InputThur() fri = InputFri() payrate = Inputrate() 'Step2. Process fri = checkfri(fri) x = payhour(mon, tue, wed, thu, fri) y = payamount(mon, tue, wed, thu, fri, x, payrate) 'Step3. Output outputreg(x, y) End Sub Function checkfri(ByVal fri As Double) If fri >= 4 Then fri = +4 End If Return fri End Function Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click 'Step0. Declarations Dim mon, tue, wed, thu, fri, x, payrate, z As Double 'Step1. Input mon = InputMon() tue = InputTue() wed = InputWed() thu = InputThur() fri = InputFri() payrate = Inputrate() 'Step2. Process x = payhour(mon, tue, wed, thu, fri) z = calcavg(x) 'Step3. Output outputreport(x, z) moreight(mon, tue, wed, thu, fri) End Sub Function calcavg(ByVal x As Double) Dim z As Double z = x / 5 Return z End Function Sub moreight(ByVal mon As Double, ByVal tue As Double, ByVal wed As Double, ByVal thu As Double, ByVal fri As Double) If mon > 8 Then outputeight("Monday") End If If tue > 8 Then outputeight("Tuesday") End If If wed > 8 Then outputeight("Wednesday") End If If thu > 8 Then outputeight("Thursday") End If If fri > 8 Then outputeight("Friday") End If End Sub Function outputeight(ByVal x As String) x = Me.LOutput.Items.Add("You have worked on " & x & " more then 8 hours") Return x End Function Sub outputreport(ByVal x As Double, ByVal z As Double) With LOutput.Items .Add("You have worked " & x & "hours") .Add("The average amount of hours you have worked is " & z) End With End Sub End Class