Question: by c program Write a C program that do the following: Prompts the user to input an integer that represents one of the following choices
Write a C program that do the following: Prompts the user to input an integer that represents one of the following choices for computing the displacement of an object: 1. Using Final Velocity 2. Using Acceleration Save the input in an integer variable named choice. Based on the choice value: If the user entered an incorrect choice (not 1 or 2), a warning message is displayed as follows: The only available choices are: 1. Using Final Velocity 2. Using Acceleration If the user's choice is 1: Ask the user to enter the Final velocity Initial velocity Time Use the following equation to compute the displacement (in meters): d = V + , Where dis displacement of an object (in meters), vis its final velocity (in meters/second), viis its initial velocity (in meters/second), and is time (in seconds). If the user's choice is 2: Ask the user to enter the : Acceleration Initial velocity Time the following equation is used to compute displacement (in meters): d = vi xt +0.5 xa xt? Where d is displacement (in meters), w is its initial velocity (in meters/second), is time (in seconds), and a is acceleration (in meters/second) Based on the selected choice, the result is displayed Sample input/output Choose one of the following to compute the displacement: 1 -Using Final velocity 2-Using the Acceleration What is your choice? input the following information: Initial Velocity (m/s): Final Velocity (m/s): Time (s): 14.3 52.1 12.8 Displacement = 424.96 m
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
