Private Sub calculateButton_Click(ByVal sender As System.Object, _ ByVal e As System.EventArgs) Handles calculateButton.Click 'declare variables Dim employeeId As String Dim employeeName As String Dim weeklyHours As Decimal Dim hourlyWage As Decimal Dim weeklyGrossEarnings As Decimal Dim healthInsuranceCost As Decimal = 25 Dim dentalInsuranceCost As Decimal = 5 Dim lifeInsuranceRate As Decimal = Convert.ToDecimal(0.05) Dim insuranceDiscountRate As Decimal = Convert.ToDecimal(0.2) Dim taxRate As Decimal = Convert.ToDecimal(0.1) Dim tax As Decimal Dim insuranceCost As Decimal Dim netPay As Decimal Dim hoursConverted As Boolean Dim wageConverted As Boolean Dim totalhealth As Decimal Dim totaldental As Decimal Dim totallife As Decimal ' input employeeId = idTextBox.Text employeeName = nameTextBox.Text hoursConverted = Decimal.TryParse(hoursTextBox.Text, weeklyHours) wageConverted = Decimal.TryParse(wageTextBox.Text, hourlyWage) ' processing If hoursConverted AndAlso wageConverted Then weeklyGrossEarnings = weeklyHours * hourlyWage tax = weeklyGrossEarnings * taxRate For number As Integer = 0 To insuranceListBox.SelectedIndices.Count - 1 If insuranceListBox.SelectedItems(number) Is "Health" Then totalhealth = healthInsuranceCost End If If insuranceListBox.SelectedItems(number) Is "Dental" Then totaldental = dentalInsuranceCost End If If insuranceListBox.SelectedItems(number) Is "Life" Then totallife = weeklyGrossEarnings * lifeInsuranceRate End If Next If insuranceListBox.SelectedIndices.Count = 3 Then insuranceCost = (totalhealth + totaldental + totallife) * (1 - insuranceDiscountRate) Else insuranceCost = (totalhealth + totaldental + totallife) End If netPay = weeklyGrossEarnings - tax - insuranceCost ' output outputLabel.Text = "Gross earnings: " & weeklyGrossEarnings.ToString("C2") _ & ControlChars.NewLine _ & "Insurance: " & insuranceCost.ToString("C2") _ & ControlChars.NewLine _ & "Tax " & tax.ToString("C2") _ & ControlChars.NewLine _ & "Net pay: " & netPay.ToString("C2") Else MessageBox.Show("Please enter numbers for hours and wages", _ "Employee Payroll", MessageBoxButtons.OK, MessageBoxIcon.Information) End If End Sub