C++ Code When an object is falling because of gravity, the following formula can be used to determine the distance the o

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899603
Joined: Mon Aug 02, 2021 8:13 am

C++ Code When an object is falling because of gravity, the following formula can be used to determine the distance the o

Post by answerhappygod »

C++ Code
When an object is falling because of gravity, the followingformula can be used to determine the distance the object falls in aspecific time period:
d = 1/2 gt2
The variables in the formula are as follows: d is the distancein meters, g is 9.8, and t is the amount of time, in seconds, thatthe object has been falling.
Write a functionnamed fallingDistance that accepts anobject’s falling time (in seconds) as an argument. The functionshould return the distance, in meters, that the object has fallenduring that time interval. Write a program that demonstrates thefunction by prompting the user for the total time and callingthe function in a loop that passes the time values in 5 secondincrements as the argument and displays the elapsed time and returnvalue. The output should have a header identifying the column namesand tabular formatted values (values displayed are toillustrate formatting only):
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply