Public Class Form1 Sub say(ByVal s As String) 'Show a str Me.LstPay.Items.Add(s) End Sub Sub saywhat(ByVal s As String, ByVal v As Double) 'Display a value, preceded by a msg say(s & " " & Format(v)) End Sub Function add(ByVal mon As Double, ByVal tue As Double, ByVal wen As Double, ByVal thu As Double, ByVal fri As Double) As Double Return mon + tue + wen + thu + fri End Function Private Sub TxtTue_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtTue.TextChanged End Sub Private Sub BClose_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BClose.Click Me.Close() End Sub Private Sub BMwf_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BMwf.Click lblMon.ForeColor = Color.Green LblTue.ForeColor = Color.Red LblWed.ForeColor = Color.Green LblThu.ForeColor = Color.Red LblFri.ForeColor = Color.Green End Sub Private Sub BTT_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTT.Click lblMon.ForeColor = Color.Red LblTue.ForeColor = Color.Green LblWed.ForeColor = Color.Red LblThu.ForeColor = Color.Green LblFri.ForeColor = Color.Red End Sub Private Sub BSame_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BSame.Click lblMon.ForeColor = Color.Yellow LblTue.ForeColor = Color.Yellow LblWed.ForeColor = Color.Yellow LblThu.ForeColor = Color.Yellow LblFri.ForeColor = Color.Yellow End Sub Private Sub BReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BReport.Click 'Declarations Dim Mon As Double Dim Tue As Double Dim wen As Double Dim thu As Double Dim fri As Double Dim total As Double Dim s As String Dim avg As Double Dim more As Double 'input Mon = getMon() Tue = getTue() wen = getWen() thu = getThu() fri = getFri() 'Processing total = add(Mon, Tue, wen, thu, fri) avg = total / 5 If Mon > 8 Then more = 1 + more End If If Tue > 8 Then more = 1 + more End If If wen > 8 Then more = 1 + more End If If thu > 8 Then more = 1 + more End If If fri > 8 Then more = 1 + more End If 'Output: display mon-fri total saywhat("Total number of hours worked", total) saywhat("Average number of hours worked", avg) saywhat("Number of days with more then 8 hours worked", more) End Sub Private Sub TxtMon_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TxtMon.TextChanged End Sub Function getMon() As Double 'Get the first value. Dim total As String total = Val(Me.TxtMon.Text) Return total End Function Function getTue() As Double 'Get the second value. Dim total As String total = Val(Me.TxtTue.Text) Return total End Function Function getWen() As Double 'Get the third value. Dim total As String total = Val(Me.TxtWen.Text) Return total End Function Function getThu() As Double 'Get the fourth value. Dim total As String total = Val(Me.TxtThu.Text) Return total End Function Function getFri() As Double 'Get the fifth value. Dim total As String total = Val(Me.TxtFri.Text) Return total End Function Function getRate() As Double 'Get the rate Dim rate As Double Dim s As String s = Me.TxtRate.Text Rate = Val(s) Return rate End Function Private Sub BRegular_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BRegular.Click Dim Mon As Double Dim Tue As Double Dim wen As Double Dim thu As Double Dim fri As Double Dim total As Double Dim rate As Double Dim owe As Double 'input Mon = getMon() Tue = getTue() wen = getWen() thu = getThu() fri = getFri() rate = getRate() 'Processing total = add(Mon, Tue, wen, thu, fri) owe = total * rate 'Output: display mon-fri total saywhat("-- Total number of hours worked", total) saywhat("-- Rate:$", rate) saywhat("Total pay:$", owe) End Sub Private Sub BMon_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BMon.Click Dim Mon As Double Dim Tue As Double Dim wen As Double Dim thu As Double Dim fri As Double Dim total As Double Dim rate As Double Dim owe As Double 'input Mon = getMon() Tue = getTue() wen = getWen() thu = getThu() fri = getFri() rate = getRate() 'Processing If getMon() = 0 Then Mon = 8 End If total = add(Mon, Tue, wen, thu, fri) owe = total * rate 'Output: display mon-fri total saywhat("-- Total number of hours worked", total) saywhat("-- Rate:$", rate) saywhat("Total pay:$", owe) End Sub Private Sub Belection_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Belection.Click Dim Mon As Double Dim Tue As Double Dim wen As Double Dim thu As Double Dim fri As Double Dim total As Double Dim rate As Double Dim owe As Double 'input Mon = getMon() Tue = getTue() wen = getWen() thu = getThu() fri = getFri() rate = getRate() 'Processing If getTue() >= 2 Then Tue = 2 + getTue() End If total = add(Mon, Tue, wen, thu, fri) owe = total * rate 'Output: display mon-fri total saywhat("-- Total number of hours worked", total) saywhat("-- Rate:$", rate) saywhat("Total pay:$", owe) End Sub Private Sub BXmas_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BXmas.Click Dim Mon As Double Dim Tue As Double Dim wen As Double Dim thu As Double Dim fri As Double Dim total As Double Dim rate As Double Dim owe As Double 'input Mon = getMon() Tue = getTue() wen = getWen() thu = getThu() fri = getFri() rate = getRate() 'Processing If getFri() >= 4 Then fri = 4 + getFri() End If total = add(Mon, Tue, wen, thu, fri) owe = total * rate 'Output: display mon-fri total saywhat("-- Total number of hours worked", total) saywhat("-- Rate:$", rate) saywhat("Total pay:$", owe) End Sub Private Sub BClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BClear.Click 'Clear the output Me.LstPay.Items.Clear() End Sub Private Sub BReset_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BReset.Click 'Clear the input Me.TxtMon.Text = "" Me.TxtTue.Text = "" Me.TxtWen.Text = "" Me.TxtThu.Text = "" Me.TxtFri.Text = "" Me.TxtRate.Text = "" End Sub End Class