Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a C++program that computes the height of a ball thrown into the air from 5 feet above the ground. Your program must: 1. Have

Write a C++program that computes the height of a ball thrown into the air from 5 feet above the ground. Your program must: 1. Have a procedure called ballHeight which has an input parameter, seconds, an input parameter speed and one output parameter, height. 2. This procedure computes the height of the ball in feet using this formula: height = - 16 * seconds2 + speed * seconds + initial_height. 3. The main program should call ballHeight within a loop which which passes the seconds staring at 0 and increments the seconds by 0.20 each iteration. 4. Display a table with time in seconds and height in feet. 5. The table should display the seconds and height to 2 decimal places. 6. The table ends at the fifth of a second before the ball hits the ground. In other words, the height does not go negative. 8. The heights will be different for different input speeds. Test your program to make sure it Sample Output (input in bold) Please enter the speed at which the ball is thrown: 35 Time Height =========== 0.00 5.00 0.20 11.36 0.40 16.44 0.60 20.24 0.80 22.76 1.00 24.00 1.20 23.96 1.40 22.64 1.60 20.04 1.80 16.16 2.00 11.00 2.20 4.56

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

Step: 3

blur-text-image

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

Database Programming With Visual Basic .NET

Authors: Carsten Thomsen

2nd Edition

1590590325, 978-1590590324

More Books

Students also viewed these Databases questions