Create a class that creates a formatted file

Assignment Help JAVA Programming
Reference no: EM131914847

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

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

Create a class, RunnerData, 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. 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

Your solution should have three methods:

// 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
//
// The method returns the number of runners (rows) found in the file.
//
private static int importData(string filepath, int[][] runnerData);

// Outputs a table including runner average.
// 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
//
private static void exportTable(string filepath, int[][] runnerData, int runnerCount);

// This function will load data from a file called "input.txt" and output to a file
// called "output.txt".
//
public static void main(String[] args);

The main() method 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 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: EM131914847

Questions Cloud

What defenses could the rowleys raise to the claim : Jesse Dimmick, trying to escape police questioning in a murder investigation, burst into Jared and Lindsay Rowley's Kansas home with a knife.
Defend virginia metal in the given case : Allen M. Campbell Co. sought a contract to build houses for the U.S. Navy. Approximately one half hour before the housing bids were due, Virginia Metal.
Compute the companys margin of safety : Compute the company's margin of safety. Compute the company's margin of safety as a percentage of its sales.
Perform a swot analysis : Look at your organization (or one similar to it) and perform a SWOT analysis. For any reason you cannot use your organization, perform SWOT analysis
Create a class that creates a formatted file : Create a class, RunnerData, 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 accounting and npv breakeven levels of sales : What are the accounting and NPV breakeven levels of sales? How do your answers change if the firm's tax rate is 40 percent?
Select a global strategic alliance for the girl scouts : Select a global strategic alliance for the Girl Scouts. Describe a plan describing the reason for your global strategic alliance suggestion for the Girl Scouts
How should the case be decided : In a 2013 televised interview with Oprah Winfrey, Lance Armstrong admitted to taking performance-enhancing drugs during his cycling career.
Calculate the target variable cost per unit : Annual sales volume is expected to average 120,000 phones over an expected life cycle of 5 years. Calculate the target variable cost per unit

Reviews

Write a Review

JAVA Programming Questions & Answers

  Recursive factorial program

Write a class Array that encapsulates an array and provides bounds-checked access. Create a recursive factorial program that prompts the user for an integer N and writes out a series of equations representing the calculation of N!.

  Hunt the wumpus game

Reprot on Hunt the Wumpus Game has Source Code listing, screen captures and UML design here and also, may include Javadoc source here.

  Create a gui interface

Create GUI Interface in java programing with these function: Sort by last name and print all employees info, Sort by job title and print all employees info, Sort by weekly salary and print all employees info, search by job title and print that emp..

  Plot pois on a graph

Write a JAVA program that would get the locations of all the POIs from the file and plot them on a map.

  Write a university grading system in java

University grading system maintains number of tables to store, retrieve and manipulate student marks. Write a JAVA program that would simulate a number of cars.

  Wolves and sheep: design a game

This project is designed a game in java. you choose whether you'd like to write a wolf or a sheep agent. Then, you are assigned to either a "sheep" or a "wolf" team.

  Build a graphical user interface for displaying the image

Build a graphical user interface for displaying the image groups (= cluster) in JMJRST. Design and implement using a Swing interface.

  Determine the day of the week for new year''s day

This assignment contains a java project. Project evaluates the day of the week for New Year's Day.

  Write a java windowed application

Write a Java windowed application to do online quiz on general knowledge and the application also displays the quiz result.

  Input pairs of natural numbers

Java program to input pairs of natural numbers.

  Create classes implement java interface

Interface that contains a generic type. Create two classes that implement this interface.

  Java class, array, link list , generic class

These 14 questions covers java class, Array, link list , generic class.

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