Categories
Programming

Woke up this morning

Woke up this morning, went to my Enterprise Computing class (an amusingly basic programming class I was encouraged to take because it’s VisualBasic .NET), to do this silly problem where using a loop calculate how long it would take to pay for payment making wage per hour:

Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
        ‘ Declarations
        Dim payment, wage, totalWage, hours As Single
 
        ‘ Get input
        payment = Val(txtPayment.Text)
        wage = Val(txtWage.Text)
 
        ‘ Do the magic
        hours = 0
        totalWage = 0
        Do While (totalWage < payment)
            totalWage += wage
            hours += 1
        Loop
 
        ‘ Print the result
        lblResult.Text = hours
    End Sub

Yea, I feel really good. And yes, that’s supposed to be a loop. 😀 Well worth getting out of bed ;-). Got a good laugh out of coming to class to see that as the lab.

Leave a Reply

Your email address will not be published.