Question: Time to preview question:00:09:11 java// C reate a League class with the following details: League alleyName (String) address (String) dayOfWeek (String) startTime (LocalTime) listOfTeams (ArrayList

Time to preview question:00:09:11

java//

C reate a League class with the following details:

League

alleyName (String) address (String) dayOfWeek (String) startTime (LocalTime) listOfTeams (ArrayList)

In the Tester class, c reate a League. Use the non-default constructor to pass in values for all instance variables (using the arraylist you c reated earlier as the listOfTeams).

Back in the league class, add a new method called duplicateLeagueForNextSession( ). Return a League with the exact same details at the league passed in - except the startTime is one hour earlier due to daylight savings time. (There is a method in LocalTime that allows you to reduce the time by one hour.)

The constructor in the method might look a little funky but this is how you can get the data out of the object you are using:

League abc = new League(this.alleyName, this.address, this.dayOfWeek, this.startTime, this.listOfTeams);

Then you can reduce the startTime by an hour and assign the new value.

(Also, you can c reate a new League and use the getters/setters to pull out/push the details but the earlier line is much more condensed).

This method should not take a parameter.

Finally, return the new league from the method. (return abc;)

In your tester, create a new League based off the existing league. Print it out to verify they are getting the same details as the first league, except with the updated startTime. As a reminder, your method will be returning a team, so you will need to capture it in your tester.

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!