Ayuda HP Code VB
Publicado por DonGatoPR (3 intervenciones) el 06/12/2006 12:21:09
I need to write a program to calculate a horsepower, f = weight, d=distance and t=time, the formula is HP=(f * d) / (t * 550) .
550 es una cantidad constante.
By enter the weight and distance on a texbox and display the results on a listbox .
Use a For Loop to calculate the horsepower needed to lift the weight, where the value for time goes from 1 to 60 seconds, increment in units 2 seconds each time trough the loop.
Que estoy haciendo mal?
Este es el codigo que tengo hasta ahora....
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim f As Integer
Dim d As Integer
Dim t As Integer = 1
Dim res As Integer
f = txtWeight.Text
d = txtDistance.Text
Do
Do While t < 60
t += 2
If t = 60 Then
t = False
Exit Do
End If
Loop
Loop Until t = False
res = CInt((f * d) / (t * 550))
lstDisplay.Items.Add(res.ToString)
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
lstDisplay.Items.Clear()
txtWeight.Text = "0"
txtDistance.Text = "0"
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
End Class
550 es una cantidad constante.
By enter the weight and distance on a texbox and display the results on a listbox .
Use a For Loop to calculate the horsepower needed to lift the weight, where the value for time goes from 1 to 60 seconds, increment in units 2 seconds each time trough the loop.
Que estoy haciendo mal?
Este es el codigo que tengo hasta ahora....
Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click
Dim f As Integer
Dim d As Integer
Dim t As Integer = 1
Dim res As Integer
f = txtWeight.Text
d = txtDistance.Text
Do
Do While t < 60
t += 2
If t = 60 Then
t = False
Exit Do
End If
Loop
Loop Until t = False
res = CInt((f * d) / (t * 550))
lstDisplay.Items.Add(res.ToString)
End Sub
Private Sub btnClear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnClear.Click
lstDisplay.Items.Clear()
txtWeight.Text = "0"
txtDistance.Text = "0"
End Sub
Private Sub btnExit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnExit.Click
End
End Sub
End Class
Valora esta pregunta


0