Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started