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

  Consider an algorithm for computing cubes using addition

You have a computer where multiplication is an enormously expensive operation compared to addition. Consider an algorithm for computing cubes using only addition (FYI: the first 5 cubes are 13 = 1, 23 = 8, 33 = 27, 43 = 64 and 53 = 125). This comp..

  Write a java tcp socket program to do tcpsocket server

Write a Java TCP socket program to do TCPSocket server. When starts the server, IP address of the machine must be displayed so the client can use to connect.

  Study the code and implement the operator overloading

The Table Q3 on the next page is the code of a class named Circle. Study the code and implement the operator overloading for these relational operators ( , >=) for the Circle class. Then, write a test program that creates two instances of the Circle ..

  Create a class - constructor for a region

The skeleton provides you with several HTML pages and associated JavaScript and CSS files representing the structure of the app. You will need to implement the logic and functionality for each of these pages - demonstrate how to change from one pag..

  Create a virtual world application

Create a Virtual World application as your final project. This Virtual World will have several objects including a MyClone object and another object of your choice.

  Write a program that will store the celtics

Write a program that will store the Celtics (or your favorite basketball team) roster in an array - You will then loop through the array to display each player

  Design and implement a rmi-based client

In this assignment, you are requested to build a system which allows a school pupil to practise multiple choice tests in math. Design and implement a RMI-based Client / Server communication system in Java, which will do the following:

  Run on ethanol and gas

Suppose a car can run on ethanol and gas and you have a 15 gallons tank to fill. You can buy fuel that is either 30 percent ethanol or 80 percent ethanol. How much of each type of fuel should you mix so that the mixture is 40 percent ethanol?

  Write java classes for the class diagram

Write Java classes for the class diagram. You don't need to write any set and get methods for simplicity.

  Find a java application on the web and describe it

What functionality does the application have that you have learned about in this class?

  1obtaining the new script download and save the attached

1.obtaining the new script download and save the attached comment cgi mailer script form-mail.pl to your servers

  Prepare a second class to test the receipt class

Prepare a second class to test the receipt class - Make this program using java programming. Make this application in simple way.

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