Question: Task 4 - Checkpoint 2 0 ( Challenging ) Modify the program developed in Task 3 as directed below. The class Boat should be extended
Task Checkpoint Challenging
Modify the program developed in Task as directed below.
The class Boat should be extendedmodified to include the following:
i a method called adjustedRaceTime that takes formal parameters named start and end both of type int which are
the start time and end time in hour format, ie etc. and returns a String which is the adjusted time in minutes
it took to complete the race.
The method should perform as follows:
a Check to ensure that the start time is before the end time, if not return "Incorrect time keeping"
b calculate the elapsed time in minutes you will have think carefully about how to do this with a hr clock
c calculate the adjusted time as a double using the following formula:
elapsed time yardstick
d return the adjusted time formatted to a maximum of decimal places
ii The class BoatMaker should be extended to include the following:
a a method with the following header:
public static int getCorrectedTimeint min, int max
which produces a random number in the range of min to max. This number must be in correct hr format, so you may
have to check and make adjustments for it to comply. which produces a random number in the range of min to max. This number must be in correct hr format, so you may
have to check and make adjustments for it to comply.
This will only happen for the minutes section. For example,
b Add the following code to the main method, and fill in the missing sections:System.out.print ln
generate a corrected start time between and
set up variables you will need to calculate the best time
int index ; set up variables you will need to calculate the best time
int index ;
while index create a new Boat with the default constructor generate a corrected end time between and Print out the Boat sequence number, start time, end time, yardstick and adjusted time determine the best time
System.out.println
System.out.printlnThe winner of the race is: Boat boatNum System.out.printlnThe winner of the race is: Boat boatNum
with a time of bestTime minutes";
If the start time was corrected to your code may produce output similar to the following:
Boat # Start End Ydstk Adjusted Time mins
The winner of the race is: Boat with a time of minutes
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
