I am taking my first coding class this semester, and wanted to get some help with ways to do some of the coding. Below is a non graded practice to help get ready for our first lab and I would like to know how you all would go about the code.
Introduction
The 2018 Winter Olympics in Pyeong Chang, South Korea, were very exciting with the US winning a total of 23 medals. This lab takes a look at the short track speed skating event whose finals had tickets starting at 150,000 Won (about $140 on 1/17/2018). Of course, airfare and lodging would have been over $1,200 and you’d have had to miss class to go ...
So, what is short track speed skating? “Short track speed skating is an umbrella term that encompasses four men's and four women's races. Each race takes place on an oval track of ice that is 111.2 meters long, while the entire sheet of ice is 60 meters long and 30 meters wide.
The simplest way to conceptualize short track speed skating—and there's really no reason to complicate things—is by thinking of it as a track and field race, but on ice. The one main difference between the short-distance track races and short track speed skating is that there are no lanes in the short track, so there is a bit of an advantage for those who start on the inside starting position.
Skaters travel in a counterclockwise direction, which means only left turns are made, just as in NASCAR.” (
https://www.si.com/olympics/2017/12/18/2018-winter-olympics-rookies-guide-short-track-speed-skating-pyeongchang 1/17/2018)
Individual (non-relay) short track speed skating has 3 different distances: 500, 1000 and 1500 meters. See this video of the 500 meter short track speed skating finals from the 2006 Olympics in Turin, Italy where the United States competitor Apolo Ohno won a gold medal:
https://www.olympic.org/videos/apolo-anton-ohno-becomes-the-fastest-man-in-500m
Detailed Information
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=(sB-sA)/(tB-tA)
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 floating-point number 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.
Hint: draw a number line and compute acceleration by hand for all laps for the Sample Execution above. This will help you figure out the algorithm.