Question
You are to write a program that will keep a record of the results of one event (50 freestyle or 40 Free) in a swimming
You are to write a program that will keep a record of the results of one event (50 freestyle or 40 Free) in a swimming competition. You will create a class that will keep track of the swimmers and the time recorded when they swam the event. In a swimming competition, each event is divided into heats where in a 6-lane pool, there will be at most 6 swimmers swimming in a heat. The swimmers are assigned to a heat based on their fastest recorded time for swimming an event, in this case the 50 Free. The swimmers are assigned to a heat from slowest to fastest, with the fastest swimmers in the last heat.
You are to create two classes:
1. Swimmer class with the following instance fields:
first name
last name
time recorded after the swimmer swam the 50 Free.
The time is recorded in the format MM:SS.MS, where MM is minutes, SS is seconds, MS is milliseconds. The Swimmer class will have a constructor that accepts values for all instance fields.It will also have the following methods:
getter methods for all instance fields.
method that will return the time value as milliseconds
toString method that will format the name as in the sample screen output
2. SwimmerApp class. The SwimmerApp class will create an ArrayList of Swimmer objects. The class has already been started for you with a method that loads an ArrayList with Swimmer objects.
There will be 4 ArrayLists with 6 swimmers, each ArrayList represents a heat in a swimming event.
From the array of Swimmer objects, you will display the winner of each heat, winner is always the one with the shortest time (Hint: use the method that converts the time (in String format) to milliseconds). 2
Sample Screen output (data displayed not from data in an actual program)
Heat 1: Emely Rose Lee, 00:27:15 Rachel Marion, 00:45:22
Anna Cabral, 00:27.02
Heat Winners are:
Heat 1: Anna Cabral, 00:27.02
Heat 2: Nina Lopez, 00:25.00
Heat 3: Jen Ingersoll, 00:25.01
Heat 4: Amber Leider, 00:26.12
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