Write a program that creates a formatted file that displays


Problem

A local running group held a one hour track event where people tried to complete as many miles as they could in one hour. The times were recorded and saved in a file. Each line of the file represents a runner and each line contains 10 entries. The entries are the number of seconds it took to the runner to complete that mile. An entry of zero means the runner didn't finish that mile. You may assume the file will never have more than 20 runners. An example file might look like this:

372 368 375 380 381 383 390 382 380

0 352 355 357 359 358 361 365 362 362

360 575 572 570 569 572 570 0 0 0 0

Write a program that creates a formatted file that displays the mile times in "minutes:seconds" format and adds an extra column at the end with the average mile time for the runner and an extra column that gives the average mile time for the mile. If the runner didn't complete a mile, the entry should be empty.

The above example input would generate the following output:

6:12 6:08 6:15 6:20 6:21 6:23 6:30 6:22 6:20 | 6:19

5:52 5:55 5:57 5:59 5:58 6:01 6:05 6:02 6:02 6:00 | 5:59

9:35 9:32 9:30 9:29 9:32 9:30 | 9:31

---------------------------------------------------

7:13 7:11 7:14 7:16 7:17 7:18 6:17 6:12 6:11 6:00

Your solution should have four functions:

// Reads the data from the specified file and stores it in the supplied table.

// filepath : a path to the file containing the data

// runnerData : the array to store the data read from the file

// runnerCount : the number of rows of data in the file

// void importData(string filepath, int runnerData[][10], int &runnerCount);

// Outputs a table including runner average and individual mile averages.

// filepath : a path to the file where the table should be written

// runnerData : the array containing the mile times in seconds

// runnerCount : the number of rows of data in the table

// void exportTable(string filepath, int runnerData[][10], int runnerCount);

// Converts the input in seconds to its minute and seconds equivalent.

// inSeconds : the time to convert in seconds

// outMinutes : the number of minutes contained in the input

// outSeconds : the number of remaining seconds contained in the input after taking // out minutes.

// void toMinutesAndSeconds(int inSeconds, int &outMinutes, int &outSeconds);

// This function will load data from a file called "input.txt" and output to a file

// called "output.txt".

// int main();

The main() function will not be very involved. It will likely consist of the declaration of a handful of variables and then simply calling the import and export functions. Your export function will call toMinutesAndSeconds() Your program should not interact with the user. The input file could have any number of lines, but all lines will contain 10 values.

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: Write a program that creates a formatted file that displays
Reference No:- TGS02779574

Expected delivery within 24 Hours