Question: c++ how to get sample run2? Question 2(5pt): Braking Distance Displacement, D (i.e. a distance) for a braking vehicle can be calculated with the initial

c++ how to get sample run2?

c++ how to get sample run2? Question 2(5pt): Braking Distance Displacement, D

(i.e. a distance) for a braking vehicle can be calculated with theinitial velocity, I, the final velocity, F, and deceleration, a. (F2 12)

Question 2(5pt): Braking Distance Displacement, D (i.e. a distance) for a braking vehicle can be calculated with the initial velocity, I, the final velocity, F, and deceleration, a. (F2 12) (-2a) Write a function called displacement that takes as parameters: initial velocity, I, final velocity F, and deceleration a. Function specifications: Your function must be named displacement Your function takes three parameters (all double, in this order) o Initial velocity I o Final velocity F o Deceleration a Your function should return the appropriate displacement, D, of the vehicle as double. If one or more values are invalid, the function print all the error messages in this order and return 0. If your function receives negative velocities then it must print "Velocity should be greater than zero." If your function receives a zero deceleration then it must print "No brakes were applied." If your function receives a negative deceleration then it must print "The vehicle is speeding up." If your function receives F > I then it must print Error in acceleration values." For example: Bob is riding his bicycle to the store at a velocity of 4 m/s, when an aardvark runs out in front of him. He quickly brakes to a complete stop, with a deceleration of 2 m/s. What is his displacement? Note that because Bob is stopped, the final velocity, F = 0. His initial velocity, I = 4 m/s. The deceleration is 2 m/s. Therefore the function should return 4. (02 4?) 4 (-2-2) = 4 Sample run 1 (bold is user input) Enter initial velocity: 10 Enter final velocity: 1 Enter deceleration: 5 Displacement is 9.9 Sample run 2 (bold is user input) Enter initial velocity: 1 Enter final velocity: 2 Enter deceleration: 0 No brakes were applied. Error in acceleration values

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!