Question
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:
- Read from a file called Runners.txt (example attached).
- The Runners.txt file should have 3 space-separated column, each row storing
- Name of the runner
- Distance of the run (in miles, decimal)
- Time of the run (in minutes, decimal)
- The Runners.txt file should have 3 space-separated column, each row storing
- Output to System.out:
- The total number of runs from step 1
- The total distance of all runs from step 1
- The total time of all runs from step 1
- The names of each runner from step 1
The WriteRunnersMain class should:
- Create a writeable file called NewRunners.txt
- Ask the user for number of runs
- For each run:
- Ask the user the name of the runner for a run
- What the distance was in miles (in decimal format)
- What the time was in minutes (in decimal format, e.g. 23.9 minutes is acceptable)
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started