Question
This is a rework of a previous exercise, here is the question: Redo programming exercise 12 at the end of chapter 8 using dynamic arrays
This is a rework of a previous exercise, here is the question:
Redo programming exercise 12 at the end of chapter 8 using dynamic arrays. Creation of dynamic two-dimension arrays is discussed on page 836 of your textbook.
Jason, Samantha, Ravi, Sheila, and Ankit are preparing for an upcoming marathon. Each day of the week, they run a certain number of miles and write them into a notebook. At the end of the week, they would like to know the number of miles run each day, the total miles for the week, and average miles run each day. Write a program to help them analyze their data. Your program must contain parallel array (in this revision use dynamic array): an array to store the names of the runners and a two-dimensional array of five rows and seven columns to store the number of miles run by each runner each day. Furthermore, your program must contain at least the following functions: a function to read and store the runners names and the numbers of miles run each day; a function to find the total miles run by each runner and the average number of miles run each day; and a function to output the results. (You may assume that the input data is stored in a file and each line of data is in the following form: runnerName milesDay1 milesDay2 milesDay3 milesDay4 milesDay5 milesDay6 milesDay7.) The catch here is, instead of using parallel arrays, the program must use dynamic arrays
Here is the data file for runs.txt:
Jason 7 12 30 9 3 40 55
Samantha 20 11 39 1 24 70 33
Ravi 10 9 8 7 6 5 4
Sheila 25 27 28 21 30 10 22
Ankit 12 18 38 40 11 35 6
I saw the other solutions on how this was made using parallel arrays. This time it needs to be run on dynamic array. This must be on C++ format and it needs to be a working code. I would truly appreciate the help to get this solve, so please help :)
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