Public Class frmPay

  Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
    'Calculate a person's weekly pay
    Dim hourlyWage, hoursWorked As Double
    hourlyWage = CDbl(txtWage.Text)
    hoursWorked = CDbl(txtHours.Text)
    txtEarnings.Text = FormatCurrency(Pay(hourlyWage, hoursWorked))
  End Sub

  Function Pay(ByVal wage As Double, ByVal hrs As Double) As Double
    'Calculate weekly pay with time-and-a-half for overtime
    Dim amount As Double
    Select Case hrs
      Case Is <= 40
        amount = wage * hrs
      Case Is > 40
        amount = (wage * 40) + ((1.5) * wage * (hrs - 40))
    End Select
    Return amount
  End Function

End Class
