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.

Tags: , ,

Related Posts

Related Posts


Leave a Reply

XHTML: You can use these tags: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <s> <strike> <strong>

By submitting a comment here you grant this site a perpetual license to reproduce your words and name/web site in attribution.