|
-
January 6th, 2002, 08:26 PM
#1
Programming Question
Alright, I'm trying to learn Visual Basic, and I'm still a newbie so don't flame me for what's probably a stupid question.
I'm trying to make this program that tells you how long to cook a turkey. You're supposed to cook it 17 minutes for every pound. If it's 6 pounds, it would be 102 minutes, which is 1 hour and 42 minutes. When I run the program though, it gives me 2 hours and 18 minutes. I looked over the code and I cannot figure out what the problem is and it's kind of aggrevating me. If someone can look through and find what the problem is, I'd really appreciate it. Here's the code:
Dim intWeight As Integer
Dim intMinutes As Integer
Dim intHours As Integer
Dim intTime As Integer
Private Sub cmdCalculate_Click()
intWeight = txtWeight.Text
intTime = intWeight * 17
intHours = intTime / 60
intMinutes = intTime - intHours * 60
If intHours * 60 > intTime Then
intMinutes = intHours * 60 - intTime
End If
lblTime.Caption = "Cook your turkey for " & intHours & " hours and for " & intMinutes & " minutes."
End Sub
Private Sub txtWeight_KeyPress(KeyAscii As Integer)
cmdCalculate.Visible = True
End Sub
Thanks!
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
|