Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is in c programming and can it please be done with while loops for loops and do while loops The 'Ball' Program Write a

this is in c programming and can it please be done with while loops for loops and do while loops

image text in transcribedimage text in transcribedimage text in transcribed

The 'Ball' Program Write a program to display characteristics of a ball thrown straight up into the air Ask the user for the initial height of the ball (in feet) and the initial velocity of the ball (in feet per second). Validate that both values are greater than or equal to 0. Then, calculate and display . The maximum height the ball will reach (in feet) The ball will reach its maximum height after v/32 seconds, where 'v is the initial velocity The number of seconds it will take for the ball to hit the ground (in 0.1 second intervals) Calculate the height of the ball after every 0.1 second to determine when the ball height is either 0 or a negative value A table showing the height of the ball every 0.25 seconds until the ball is on the ground Calculate the height of the ball after every 0.25 seconds, display both the time and the height, and stop when the height is either 0 or a negative value The formula for the height of the ball at any instance in time is h+v*t-16*t2 where h the initial height of the ball (in feet) v the initial velocity of the ball (in feet per second) t time (in seconds) Make sure that you use the above formula and not any other formula you might find (otherwise, your results and mine may not be the same) Display a blank line between the inputs and the maximum height and time to hit the ground, and between the maximum height and time to hit the ground and the table of heights every 0.25 second Hints: Validation error messages are indented 3 spaces Account for an initial velocity of 0 and/or an initial height of 0 When calculating when the ball will hit the ground, if the ball starts at an initial height of 0.0 ft., start with the ball's height after 0.1 second The table to display the ball's height every 0.25 seconds may require a post-test loop, with the If the ball has an initial height of 0.0 ft., and an initial velocity of 0.0 ft. per sec., only display the Use a tab to align the 2nd column (the Height column) in the table first line of the table outside the loop first line of the table Don't forget the blank line before 'Press any key to continue..." Example Run #1: (bold type is what is entered by the user) Enter the initial height of the ball (in ft.):10 The initial height must be greater than or equal to 0. Enter the initial height of the ball (in ft.): 10 Enter the initial velocity of the ball (in ft. per sec.): -20 The initial velocity must be greater than or equal to o. Enter the initial velocity of the ball (in ft. per sec.): 20 The maximum height the ball will reach is xx.x feet. The time for the ball to reach the ground is x.x seconds. Time 0.00 0.25 Height 10.0 0.0 Example Run #2: Enter the initial height of the ball (in ft.): 10 Enter the initial velocity of the ball (in ft. per sec): The maximum height the ball will reach is 10.0 feet. The time for the ball to reach the ground is x.x seconds. Time 0.00 Height 10.0 0.0 Example Run #3: Enter the initial height of the ball (in ft.): 0 Enter the initial velocity of the ball (in ft. per sec):20 The maximum height the bal1 will reach is xx.x feet. The time for the ball to reach the ground is x.x seconds. Time 0.00 0.25 Height 0.0 0.0 Example Run #4: Enter the initial height of the ball (in ft.): 0 Enter the initial velocity of the ball (in ft. per sec): The maximum height the bal1 will reach is 0.0 feet. The time for the ball to reach the ground is 0.0 seconds. Time 0.00 Height 0.0

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

Temporal Databases Research And Practice Lncs 1399

Authors: Opher Etzion ,Sushil Jajodia ,Suryanarayana Sripada

1st Edition

3540645195, 978-3540645191

More Books

Students also viewed these Databases questions