lease follow the instructions given in the screenshot very well also for the  runners.txt file here are the stuffs that are written inside it so just copy and paste it inside your own runners.txt file and you dont need to do the step one portion just step 2 to 4, also add professional comments inside the c++ code using the // command thank you 1 Margaret Hamilton 5:00 2 Barbara Liskov 6:05 3 Ida Rhodes 6:00 4 Christopher Strachey 5:20 5 Edith Windsor 4:50 6 Peter Landin 5:40 7 Lynn Conway 4:50 8 Jon Hall 6:15 9 Lois Haibt 4:15 10 Mary Ann Horton 5:05 11 Audrey Tang 4:45 12 Souradyuti Paul 6:10 13 Jean Bartik 3:55 14 Devavrat Shah 5:20 15 Komeil Bahmanpour 5:55 16 Maryam Sadeghi 4:35 17 Babak Hodjat 5:55 18 Ada Lovelace 3:40 19 Lotfi Zadeh 5:50 20 Divya Jain 4:30 21 Alan Turing 3:40 22 Grace Hopper 5:05 23 Lata Narayanan 5:45 24 Sugata Mitra 4:15 25 Bill Gates 4:40

Programming Logic & Design Comprehensive
9th Edition
ISBN:9781337669405
Author:FARRELL
Publisher:FARRELL
Chapter7: File Handling And Applications
Section: Chapter Questions
Problem 15RQ
icon
Related questions
Question
100%

please follow the instructions given in the screenshot very well also for the  runners.txt file here are the stuffs that are written inside it so just copy and paste it inside your own runners.txt file and you dont need to do the step one portion just step 2 to 4, also add professional comments inside the c++ code using the // command thank you

1 Margaret Hamilton 5:00
2 Barbara Liskov 6:05
3 Ida Rhodes 6:00
4 Christopher Strachey 5:20
5 Edith Windsor 4:50
6 Peter Landin 5:40
7 Lynn Conway 4:50
8 Jon Hall 6:15
9 Lois Haibt 4:15
10 Mary Ann Horton 5:05
11 Audrey Tang 4:45
12 Souradyuti Paul 6:10
13 Jean Bartik 3:55
14 Devavrat Shah 5:20
15 Komeil Bahmanpour 5:55
16 Maryam Sadeghi 4:35
17 Babak Hodjat 5:55
18 Ada Lovelace 3:40
19 Lotfi Zadeh 5:50
20 Divya Jain 4:30
21 Alan Turing 3:40
22 Grace Hopper 5:05
23 Lata Narayanan 5:45
24 Sugata Mitra 4:15
25 Bill Gates 4:40

Marathon Simulator
Edit April 3, 11:55 AM: If you are having trouble dealing with the runner who has a middle name, feel free to remove the middle name from the input file. If you have already figured out how to deal with the middle name (there is a way to do it
with the skills you have learned), great! That gives you a greater chance of getting "Exceeds" for input/output.
We are going to simulate running a marathon (40 kilometer foot race) with 25 runners. Each runner has a pair of parameters which dictates how long it takes them to travel one kilometre. You are provided with a file, runners.txt, containing runne
numbers, runner names, and runner pace, separated by spaces. For example:
1 John Smith 5:05
2 Sally Jones 4:55
This means that, on average, John runs 1 KM in 5 minutes 5 seconds, while Sally runs 1 KM in 4 minutes 55 seconds. Keeping that average pace, John would take 3 hours 32 minutes 20 seconds to run 40 KM, while Sally would take 3:16:40.
Step 1
Read the entire assignment, then plan out your entire program by making a flowchart. As you do so, think carefully about what you will and will not abstract.
Step 2
Write code to read the file into a paired set of two arrays:
• string name[] for the runner name
float pace[] for their pace in minutes
Since the paces in the file are stored as two integers separated by a colon, you will need to write code that can convert from minutes and seconds to floating point minutes.
Step 3
To simulate the marathon, for each kilometre that each runner ran, you will generate random values that are near their given pace. This represents the time that runner took for that kilometer. To do this, calculate a value which is 5% slower and
another value 5% faster. This is the range within which that specific runner's time will fall for any kilometre. For each kilometre, generate a random number between these two bounds. Repeat this for all runners, for all 40 kilometres.
Caution: You are looping through kilometres and runners. Think carefully about which should be your inner loop and which should be your outer loop.
Step 4
Maintain an elapsed time for each runner in a third array, float time[]. Each loop through your program will represent another kilometer elapsed in the race.
After the first 20 kilometres, output to the user the fastest runner and their elapsed time, as well as the slowest runner and their elapsed time.
At the end of the race, show the fastest and slowest runner, and generate an output file named A4output_22222222.txt (where the 2s are replaced with your student number) containing the runners and their times.
Transcribed Image Text:Marathon Simulator Edit April 3, 11:55 AM: If you are having trouble dealing with the runner who has a middle name, feel free to remove the middle name from the input file. If you have already figured out how to deal with the middle name (there is a way to do it with the skills you have learned), great! That gives you a greater chance of getting "Exceeds" for input/output. We are going to simulate running a marathon (40 kilometer foot race) with 25 runners. Each runner has a pair of parameters which dictates how long it takes them to travel one kilometre. You are provided with a file, runners.txt, containing runne numbers, runner names, and runner pace, separated by spaces. For example: 1 John Smith 5:05 2 Sally Jones 4:55 This means that, on average, John runs 1 KM in 5 minutes 5 seconds, while Sally runs 1 KM in 4 minutes 55 seconds. Keeping that average pace, John would take 3 hours 32 minutes 20 seconds to run 40 KM, while Sally would take 3:16:40. Step 1 Read the entire assignment, then plan out your entire program by making a flowchart. As you do so, think carefully about what you will and will not abstract. Step 2 Write code to read the file into a paired set of two arrays: • string name[] for the runner name float pace[] for their pace in minutes Since the paces in the file are stored as two integers separated by a colon, you will need to write code that can convert from minutes and seconds to floating point minutes. Step 3 To simulate the marathon, for each kilometre that each runner ran, you will generate random values that are near their given pace. This represents the time that runner took for that kilometer. To do this, calculate a value which is 5% slower and another value 5% faster. This is the range within which that specific runner's time will fall for any kilometre. For each kilometre, generate a random number between these two bounds. Repeat this for all runners, for all 40 kilometres. Caution: You are looping through kilometres and runners. Think carefully about which should be your inner loop and which should be your outer loop. Step 4 Maintain an elapsed time for each runner in a third array, float time[]. Each loop through your program will represent another kilometer elapsed in the race. After the first 20 kilometres, output to the user the fastest runner and their elapsed time, as well as the slowest runner and their elapsed time. At the end of the race, show the fastest and slowest runner, and generate an output file named A4output_22222222.txt (where the 2s are replaced with your student number) containing the runners and their times.
Expert Solution
steps

Step by step

Solved in 3 steps with 2 images

Blurred answer
Knowledge Booster
File Input and Output Operations
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Programming Logic & Design Comprehensive
Programming Logic & Design Comprehensive
Computer Science
ISBN:
9781337669405
Author:
FARRELL
Publisher:
Cengage
C++ for Engineers and Scientists
C++ for Engineers and Scientists
Computer Science
ISBN:
9781133187844
Author:
Bronson, Gary J.
Publisher:
Course Technology Ptr
EBK JAVA PROGRAMMING
EBK JAVA PROGRAMMING
Computer Science
ISBN:
9781337671385
Author:
FARRELL
Publisher:
CENGAGE LEARNING - CONSIGNMENT
C++ Programming: From Problem Analysis to Program…
C++ Programming: From Problem Analysis to Program…
Computer Science
ISBN:
9781337102087
Author:
D. S. Malik
Publisher:
Cengage Learning