Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Java Expert


Home >> Java

A local running group held a one hour track event where people tried to comple.te 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

Cre.ate 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 minutes:seconds" format and adds an extra column at the end with the average mile time for the runner. If the runner didn't comple.te 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.

Java, Programming

  • Category:- Java
  • Reference No.:- M93044708
  • Price:- $10

Priced at Now at $10, Verified Solution

Have any Question?


Related Questions in Java

Assessment database and multithread programmingtasktask 1

Assessment: Database and Multithread Programming Task Task 1: Grade Processing University grading system maintains a database called "GradeProcessing" that contains number of tables to store, retrieve and manipulate stud ...

Assignment taskwrite a java console application that allows

Assignment task Write a java console application that allows the user to read, validate, store, display, sort and search data such as flight departure city (String), flight number (integer), flight distance (integer), fl ...

Assessment instructionsin this assessment you will complete

Assessment Instructions In this assessment, you will complete the programming of two Java class methods in a console application that registers students for courses in a term of study. The application is written using th ...

Assessment -java program using array of Assessment -JAVA Program using array of objects

Assessment -JAVA Program using array of objects Objectives This assessment item relates to the course learning outcomes as stated in the Unit Profile. Details For this assignment, you are required to develop a Windowed G ...

Solving 2nd degree equationsbull write the following java

Solving 2nd degree equations • Write the following Java methods • boolean real-sols(double a, double b, double c): it returns true if the 2nd degree equation ax2 + bx + c has real solutions • double solution1(double a, d ...

Fundamentals of operating systems and java

Fundamentals of Operating Systems and Java Programming Purpose of the assessment (with ULO Mapping) This assignment assesses the following Unit Learning Outcomes; students should be able to demonstrate their achievements ...

Assessment socket programmingtaskwrite a java gui program

Assessment: Socket Programming Task Write a JAVA GUI program that would facilitate text chatting/exchanging between two or multiple computers over the network/internet, using the concept of JAVA socket programming. If yo ...

Retail price calculatorwrite a java program that asks the

Retail Price Calculator Write a JAVA program that asks the user to enter an item's wholesale cost and its markup percentage. It should then display the item's retail price. For example: (If an item's wholesale cost is 5. ...

Assignment game prototypeoverviewfor this assessment task

Assignment: Game Prototype Overview For this assessment task you are expected to construct a prototype level/area as a "proof of concept" for the game that you have designed in Assignment 1. The prototype should function ...

Project descriptionwrite a java program to traverse a

Project Description: Write a java program to traverse a directory structure (DirWalker.java) of csv files that contain csv files with customer info. A simple sample in provided in with the sample code but you MUST will r ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As