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:

VB.net [Show Plain Code]:
  1. Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
  2.         ‘ Declarations
  3.         Dim payment, wage, totalWage, hours As Single
  4.  
  5.         ‘ Get input
  6.         payment = Val(txtPayment.Text)
  7.         wage = Val(txtWage.Text)
  8.  
  9.         ‘ Do the magic
  10.         hours = 0
  11.         totalWage = 0
  12.         Do While (totalWage < payment)
  13.             totalWage += wage
  14.             hours += 1
  15.         Loop
  16.  
  17.         ‘ Print the result
  18.         lblResult.Text = hours
  19.     End Sub

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

Tags: , ,



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=""> <strike> <strong>

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