Question
C++ beginner help This program computes the average acceleration of a short track speed skater during each lap of a competition. The program asks the
C++ beginner help
This program computes the average acceleration of a short track speed skater during each lap of a competition. The program asks the user for a short track event (500, 1000, or 1500 meter), and for the name of the skater. Then, for each 100 meter lap, the program asks the completion time. The program computes and prints the acceleration at the end of each lap. Finally, the program asks the user for another short track event and continues processing until the user enters 0 for the event as shown below in the Sample Execution.
The formula for calculating average acceleration in meters per second squared, a, from point A to point B is given below where sA = average speed at A (from the previous point to A), sB = average speed at B (from A to B), tA = time at A, tB = time at B.
A positive acceleration means the skater sped up; a slower one means the skater slowed down.
Note: if we wanted to compute the instantaneous acceleration of a skater, the acceleration at any particular moment in time, not just the average acceleration between two points that are 100 meters apart as above, we would need to use Calculus. So, pay attention in your Calculus classes!
Sample execution (using times from above video for Apolo Ohno)
Welcome to the Short Track Speed Skating Analyzer!
Please choose an event
1 500 meters
2 1000 meters
3 1500 meters
0 exit
Event: 1
Skater first and last name: Apolo Ohno
End time of lap 1 (in seconds): 6.65
Acceleration in m/s^2: 2.26
End time of lap 2 (in seconds): 15.83
Acceleration in m/s^2: -0.45
End time of lap 3 (in seconds): 24.6
Acceleration in m/s^2: 0.06
End time of lap 4 (in seconds): 33.14
Acceleration in m/s^2: 0.04
End time of lap 5 (in seconds): 41.93
Acceleration in m.s^2: -0.04
End of analysis for Apolo Ohno
Please choose an event
1 500 meter
2 1000 meter
3 1500 meter
0 exit
Event: 0
Thank you for using the Short Track Speed Skating Analyzer!
DO NOT write your program under the assumption that the user will choose a valid event number. If the user enters an integer outside the range [0, , 3], print an error message, Invalid event x where x is the integer entered. Then print the main menu again. YOU MAY write your program under the assumption that the user will enter an integer (not a double or a bunch of letters, for example).
Display exactly 2 digits to the right of the decimal for all accelerations as shown in the Sample Execution.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started