Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

This weeks project work takes a similar track (pardon the pun) to the previous assignments. However, you are to use File I/O to complete this

This weeks project work takes a similar track (pardon the pun) to the previous assignments. However, you are to use File I/O to complete this weeks work. There needs to be two classes, each with a main method, and runnable separately, called ReadRunnersMain.java and WriteRunnersMain.java.

The ReadRunnersMain class should:

  1. Read from a file called Runners.txt (example attached).
    1. The Runners.txt file should have 3 space-separated column, each row storing
      1. Name of the runner
      2. Distance of the run (in miles, decimal)
      3. Time of the run (in minutes, decimal)
  2. Output to System.out:
    1. The total number of runs from step 1
    2. The total distance of all runs from step 1
    3. The total time of all runs from step 1
    4. The names of each runner from step 1

The WriteRunnersMain class should:

  1. Create a writeable file called NewRunners.txt
  2. Ask the user for number of runs
  3. For each run:
    1. Ask the user the name of the runner for a run
    2. What the distance was in miles (in decimal format)
    3. What the time was in minutes (in decimal format, e.g. 23.9 minutes is acceptable)
    4. Write a row in NewRunners.txt file with the name, distance, and time of the run

Note: The format of Runners.txt should match the format of NewRunners.txt. So if a file is created from WriteRunnerMain, simply renaming that file to Runners.txt, should allow it to properly run in ReadRunnerMain.

Also Note: In general, Project work will be more free-form than other assignments. Please make it as usable and readable to the user as possible. But, in this case input/output file format for both classes should match the example. Also, since you have learned Exception Handling, and to receive full credit, incorporate some appropriate try/catch exception handling to demonstrate understanding of the concept.

For my java programming ll class write a code with your own inputs and outputs following these requirements! Thank you!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Databases questions