Public Class Form1
    Inherits System.Windows.Forms.Form

#Region " Windows Form Designer generated code "

    Public Sub New()
        MyBase.New()

        'This call is required by the Windows Form Designer.
        InitializeComponent()

        'Add any initialization after the InitializeComponent() call

    End Sub

    'Form overrides dispose to clean up the component list.
    Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
        If disposing Then
            If Not (components Is Nothing) Then
                components.Dispose()
            End If
        End If
        MyBase.Dispose(disposing)
    End Sub

    'Required by the Windows Form Designer
    Private components As System.ComponentModel.IContainer

    'NOTE: The following procedure is required by the Windows Form Designer
    'It can be modified using the Windows Form Designer.  
    'Do not modify it using the code editor.
    Friend WithEvents lblWage As System.Windows.Forms.Label
    Friend WithEvents lblHours As System.Windows.Forms.Label
    Friend WithEvents lblEarnings As System.Windows.Forms.Label
    Friend WithEvents txtWage As System.Windows.Forms.TextBox
    Friend WithEvents txtHours As System.Windows.Forms.TextBox
    Friend WithEvents cmdCalculate As System.Windows.Forms.Button
    Friend WithEvents lblEarningsResult As System.Windows.Forms.Label
    <System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
        Me.lblWage = New System.Windows.Forms.Label()
        Me.lblHours = New System.Windows.Forms.Label()
        Me.lblEarnings = New System.Windows.Forms.Label()
        Me.txtWage = New System.Windows.Forms.TextBox()
        Me.txtHours = New System.Windows.Forms.TextBox()
        Me.cmdCalculate = New System.Windows.Forms.Button()
        Me.lblEarningsResult = New System.Windows.Forms.Label()
        Me.SuspendLayout()
        '
        'lblWage
        '
        Me.lblWage.AutoSize = True
        Me.lblWage.Location = New System.Drawing.Point(24, 24)
        Me.lblWage.Name = "lblWage"
        Me.lblWage.Size = New System.Drawing.Size(37, 13)
        Me.lblWage.TabIndex = 0
        Me.lblWage.Text = "Wage:"
        '
        'lblHours
        '
        Me.lblHours.AutoSize = True
        Me.lblHours.Location = New System.Drawing.Point(24, 88)
        Me.lblHours.Name = "lblHours"
        Me.lblHours.Size = New System.Drawing.Size(78, 13)
        Me.lblHours.TabIndex = 1
        Me.lblHours.Text = "Weekly Hours:"
        '
        'lblEarnings
        '
        Me.lblEarnings.AutoSize = True
        Me.lblEarnings.Location = New System.Drawing.Point(24, 144)
        Me.lblEarnings.Name = "lblEarnings"
        Me.lblEarnings.Size = New System.Drawing.Size(49, 13)
        Me.lblEarnings.TabIndex = 2
        Me.lblEarnings.Text = "Earnings"
        '
        'txtWage
        '
        Me.txtWage.Location = New System.Drawing.Point(128, 24)
        Me.txtWage.Name = "txtWage"
        Me.txtWage.Size = New System.Drawing.Size(136, 20)
        Me.txtWage.TabIndex = 3
        Me.txtWage.Text = ""
        '
        'txtHours
        '
        Me.txtHours.Location = New System.Drawing.Point(128, 88)
        Me.txtHours.Name = "txtHours"
        Me.txtHours.Size = New System.Drawing.Size(136, 20)
        Me.txtHours.TabIndex = 4
        Me.txtHours.Text = ""
        '
        'cmdCalculate
        '
        Me.cmdCalculate.Location = New System.Drawing.Point(80, 192)
        Me.cmdCalculate.Name = "cmdCalculate"
        Me.cmdCalculate.Size = New System.Drawing.Size(136, 24)
        Me.cmdCalculate.TabIndex = 6
        Me.cmdCalculate.Text = "Calculate"
        '
        'lblEarningsResult
        '
        Me.lblEarningsResult.Location = New System.Drawing.Point(128, 144)
        Me.lblEarningsResult.Name = "lblEarningsResult"
        Me.lblEarningsResult.Size = New System.Drawing.Size(136, 16)
        Me.lblEarningsResult.TabIndex = 7
        '
        'Form1
        '
        Me.AutoScaleBaseSize = New System.Drawing.Size(5, 13)
        Me.ClientSize = New System.Drawing.Size(296, 238)
        Me.Controls.AddRange(New System.Windows.Forms.Control() {Me.lblEarningsResult, Me.cmdCalculate, Me.txtHours, Me.txtWage, Me.lblEarnings, Me.lblHours, Me.lblWage})
        Me.Name = "Form1"
        Me.Text = "Wage Calculator"
        Me.ResumeLayout(False)

    End Sub

#End Region


    Private Sub cmdCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cmdCalculate.Click
        Dim dblHours As Double
        Dim decWage As Decimal
        Dim decEarnings As Decimal

        'assign values from user input
        dblHours = Val(txtHours.Text)
        decWage = Val(txtWage.Text)

        If dblHours <= 40 Then
            decEarnings = decWage * dblHours
        Else
            decEarnings = (decWage * 40) + (dblHours - 40) * (1.5 * decWage)
        End If
        lblEarningsResult.Text = String.Format("{0:C}", decEarnings)

    End Sub
End Class
