Question: Task 4 - Checkpoint 2 0 ( Challenging ) Modify the program developed in Task 3 as directed below. The class Boat should be extended

Task 4- Checkpoint 20(Challenging)
Modify the program developed in Task 3 as directed below.
The class Boat should be extended/modified to include the following:
i. a method called adjustedRaceTime that takes 2 formal parameters named start and end , both of type int , which are
the start time and end time in 24-hour format, i.e.1030,1350 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 24 hr clock
c. calculate the adjusted time (as a double ) using the following formula:
(elapsed time / yardstick)*100
d. return the adjusted time formatted to a maximum of 2 decimal places
ii. The class BoatMaker should be extended to include the following:
a. a method with the following header:
public static int getCorrectedTime(int min, int max)
which produces a random number in the range of min to max. This number must be in correct 24 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 24 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 900 and 1145
// set up variables you will need to calculate the best time
int index =0; // set up variables you will need to calculate the best time
int index =0;
while (index 8){// create a new Boat with the default constructor// generate a corrected end time between 1030 and 1230// Print out the Boat sequence number, start time, end time, yardstick and adjusted time// determine the best time}
System.out.println("-----------------------------------------------------------
System.out.println("The winner of the race is: Boat "+(boatNum +1)+ System.out.println("The winner of the race is: Boat "+(boatNum +1)+
" with a time of "+ bestTime +" minutes");
If the start time was corrected to 1118 your code may produce output similar to the following:
Boat # Start End Ydstk Adjusted Time (mins)
The winner of the race is: Boat 3 with a time of 46.46 minutes
Task 4 - Checkpoint 2 0 ( Challenging ) Modify

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!