You are viewing our Forum Archives. To view or take place in current topics click here.
Visual Basic Compute Height After 3 Seconds
Posted:

Visual Basic Compute Height After 3 SecondsPosted:

-Kraddy
  • V5 Launch
Status: Offline
Joined: Dec 13, 201013Year Member
Posts: 366
Reputation Power: 108
Status: Offline
Joined: Dec 13, 201013Year Member
Posts: 366
Reputation Power: 108
This is the question:

Suppose a ball is thrown straight up in the air with an initial velocity of 50 feet per second and an initial height of 5 feet. How high will the ball be after 3 seconds? See Fig. 3.2. Note: The height after t seconds is given by the expression - 16 t 2 + v 0 t + h 0 , where v 0 is the initial velocity and h 0 is the initial height.


So far I have:


Public Class Projectilepg68

Private Sub btnOne_Click(sender As Object, e As EventArgs) Handles btnOne.Click
Dim initVel As Integer
Dim initHt As Integer
Dim finalHt As Integer
Dim sec As Integer

initVel = 50

initHt = 5

sec = 3

finalHt = -16 * sec ^ 2 + initVel * sec + initHt
End Sub

Private Sub txtOne_TextChanged(sender As Object, e As EventArgs) Handles txtOne.TextChanged

End Sub
End Class


When I run this, nothing comes out, I know I am missing something. Anyone care to help?
#2. Posted:
speed
  • Winter 2017
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Status: Offline
Joined: Jun 11, 200915Year Member
Posts: 9,897
Reputation Power: 3160
Motto: "I'l no I grew up to fast speed I no u will be little famous" - Famous_Energy
Nothing is coming out because you're not telling anything to come out. You're assigning the final value to finalHt, but doing nothing with it after that.

So to actually see the result, you'd want to do something like update a label's text, output to console, or something like that.
#3. Posted:
Skittle
  • Comment King
Status: Offline
Joined: Aug 20, 201410Year Member
Posts: 6,813
Reputation Power: 413
Status: Offline
Joined: Aug 20, 201410Year Member
Posts: 6,813
Reputation Power: 413
You also appear to have the TextChanged handler for txtOne but appear to be doing nothing with it.

As to what speed said, you need to output the result, as you are using a Windows form, you can simply use
MsgBox(finalHt)
to produce a message box, or one of the others that speed listed above.
Jump to:
You are viewing our Forum Archives. To view or take place in current topics click here.