Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

When an object is falling because of gravity, the following formula can be used

ID: 3553264 • Letter: W

Question

When an object is falling because of gravity, the following formula can be used to determine the distance the object falls in a specific time period: d=1/2gt^2(squared)
The variables in the formula are as follows: d is the distance in meters, g is 9.8, and t is the amount of time in seconds that the object has been falling.

Create a VB app that allows the user to enter the amount of time that an object has fallen and then displays the distance that the object fell. The app should have a function named FallingDistance. The FallingDistance function should accept an objects falling time (in seconds) as an argument. The function should return the distance in meters that the object has fallen during that time interval.


·   Add the following instructions to the instructions in the text:

Calculate the distance 3 times using a loop. (So you will call the function from within the loop.

1.The first time with the time that the user entered.

2. Next with the entered time * 2.

3. And again with the entered time * 3


Here is what I get:


Private Sub btnCalculate_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnCalculate.Click


Dim distance As Decimal 'Distance to calcualte


Dim gravity As Decimal = 9.8D 'Gravity of the object


Dim time As Decimal 'Time in seconds


If TxtTime.Text = "" Then


MessageBox.Show("please enter the time", "Info")


Else


'gets the time from the text box.


time = CDec(TxtTime.Text)

'calculates the distance


distance = CDec(0.5 * gravity * Math.Pow(time, 2))


'displays the gravity


TxtDistance.Text = distance & " meters"


End If



End Sub


Can anyone help me with the loop section? I am really confused about it.

Thanks


Explanation / Answer

When an object is falling because of gravity, the following formula can be used

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote