Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

2 5 . 2 5 PRACTICE: Loops ( while ) * * : Output rocket height LAB ACTIVITY 2 5 . 2 5 . 1

25.25 PRACTICE: Loops (while)**: Output rocket height
LAB ACTIVITY
25.25.1: PRACTICE: Loops (while)**: Output rocket height
0/3
Suppose a launched toy rocket's height is computed as h = vi*t -5t2. vi is the initial velocity, and t is time in seconds since the launch (starting at 0). 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 (don't print the negative). Assume all values are integers. Ex: For input 20, the output is:
00
115
220
315
40
Hints:
Use a while loop.
t squared is easily calculated as t * t.
Use this expression for the while loop: (rocketHeight >=0).
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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

Factors Affecting Conflict

Answered: 1 week ago

Question

Describe the factors that lead to productive conflict

Answered: 1 week ago

Question

Understanding Conflict Conflict Triggers

Answered: 1 week ago