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
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