Write a program that creates a formatted file

Assignment Help Computer Engineering
Reference no: EM131985106

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.

Reference no: EM131985106

Questions Cloud

Find the amount of interest credited on february : Since June 30, 2014 Smith has been making deposits of 100 each into a bank account on the last day of each month.
Rural problems worse than urban problems : Are urban problems worse than rural problems, or are rural problems worse than urban problems?
What changes would you make to the existing security policy : What changes would you make to the existing security policy so that security is improved after employees are terminated?
Literary program was poorly supported : Practice in correcting vague pronouns. 1) The literary program was poorly supported, which frustrated many students.
Write a program that creates a formatted file : 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.
What are the 6 and 12-month maturity futures prices : Silver sells for $20 an ounce and has no convenience yield. The risk-free rate is .15% per month what are the 6 and 12-month maturity futures prices?
Change each passive voice sentence into the active voice : Change each passive voice sentence into the active voice. If the passive voice sentence contains no doer of the action, make one up for your answer sentence.
List differences between linked list and array structure : List three differences between Linked List structure and Array structure? Include the differences of How we add/remove elements in each.
The relationship between external auditor and organization : Simplified approaches for preparing pro forma statements assume that the firm's past financial condition is an accurate indicator of the future.

Reviews

Write a Review

Computer Engineering Questions & Answers

  Mathematics in computing

Binary search tree, and postorder and preorder traversal Determine the shortest path in Graph

  Ict governance

ICT is defined as the term of Information and communication technologies, it is diverse set of technical tools and resources used by the government agencies to communicate and produce, circulate, store, and manage all information.

  Implementation of memory management

Assignment covers the following eight topics and explore the implementation of memory management, processes and threads.

  Realize business and organizational data storage

Realize business and organizational data storage and fast access times are much more important than they have ever been. Compare and contrast magnetic tapes, magnetic disks, optical discs

  What is the protocol overhead

What are the advantages of using a compiled language over an interpreted one? Under what circumstances would you select to use an interpreted language?

  Implementation of memory management

Paper describes about memory management. How memory is used in executing programs and its critical support for applications.

  Define open and closed loop control systems

Define open and closed loop cotrol systems.Explain difference between time varying and time invariant control system wth suitable example.

  Prepare a proposal to deploy windows server

Prepare a proposal to deploy Windows Server onto an existing network based on the provided scenario.

  Security policy document project

Analyze security requirements and develop a security policy

  Write a procedure that produces independent stack objects

Write a procedure (make-stack) that produces independent stack objects, using a message-passing style, e.g.

  Define a suitable functional unit

Define a suitable functional unit for a comparative study between two different types of paint.

  Calculate yield to maturity and bond prices

Calculate yield to maturity (YTM) and bond prices

Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd