Question: 2 5 . 2 5 PRACTICE: Loops ( while ) * * : Output rocket height LAB ACTIVITY 2 5 . 2 5 . 1
PRACTICE: Loops while: Output rocket height
LAB ACTIVITY
: PRACTICE: Loops while: Output rocket height
Suppose a launched toy rocket's height is computed as h vit t vi is the initial velocity, and t is time in seconds since the launch starting at Write a program to read the initial velocity, then output the time and the rocket's height once per second. Stop when the height would be negative, meaning the rocket hit the ground dont print the negative Assume all values are integers. Ex: For input the output is:
Hints:
Use a while loop.
t squared is easily calculated as t t
Use this expression for the while loop: rocketHeight
Don't forget to increment time inside the while loop else you'll get an infinite loop
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
