Question: i need help with this program this is in c programming and please only use for do while and while loops also the out put

i need help with this program this is in c programming and please only use for do while and while loops also the out put has to be like the example that was provided

i need help with this program this is in c programming andplease only use for do while and while loops also the output has to be like the example that was provided here is

here is the code i have so far

#include #include int main(void) { // Constant and Variable Declarations double startingHeight = 0.0; double heightBall = 0.0; double volicetyBall = 0.0; double ballTime = 0.0; double downTime = 0.25; double maxHeight = 0.0; double timeLast = 0.0;

// *** Your program goes here *** do { printf("Enter initial height of the ball (in ft.): "); scanf("%lf", &startingHeight);

if (startingHeight

} while (startingHeight

do { printf("Enter initial velocity of the ball (in ft. per sec.): "); scanf("%lf", &volicetyBall);

if (volicetyBall

} while (volicetyBall

printf(" "); printf("Time\tHeight "); if (startingHeight 0) { printf("%0.2f\t%0.1f ", ballTime, startingHeight); }

else {

do {

heightBall = startingHeight + volicetyBall * ballTime - 16 * pow(ballTime, 2);

if (maxHeight

if (heightBall > 0) { printf("%0.2f\t%0.1f ", ballTime, heightBall); timeLast = ballTime; }

ballTime = ballTime + downTime; } while (heightBall > 0);

}

printf(" The maximum height the ball will reach is %0.1f feet ", maxHeight); printf("The time for the ball to reach the ground is %0.2f seconds ", timeLast);

printf(" ");

return 0; }

i just need the part where it says

printf(" The maximum height the ball will reach is %0.1f feet ", maxHeight); printf("The time for the ball to reach the ground is %0.2f seconds ", timeLast);

to print before it prints the table and output right and for it to be just like the example

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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!