Question: Create a Java project called League. Create a Team class teamName (String) teamId (int) numberOfPlayers (int) captain (String) Create getters and setters for all the

Create a Java project called League. Create a Team class

teamName (String) teamId (int) numberOfPlayers (int) captain (String)

Create getters and setters for all the instance variables.

Next, create a default no-arg constructor and a non-default constructor that takes the team name, number of players and captain's name & sets the values for the instance variables using the setter methods.

Create a static variable to hold the next value of the teamId. Have it start at 1000. Increase it by one each time a team is created. Assign the value into the teamId for the object for both constructors. Delete the setter for teamId - it can only be set when the team is created.

Modify the setNumberOfPlayer method so that only values between 7 and 13 can be set.

Modify the setTeamName method so that if an empty String is passed in, the value is set to null - not the empty string.

Modify the non-default constructor so that if team name is null or if the number of players is still zero, the object isn't created.

Create a toString method to use for testing.

Finally, create a method that returns a String with the team information formatted appropriately. Name the method something that you feel is appropriate.

Example: Team ID: 1000, Team Name: Gators, # of Team Members: 12, Captain Frank

Next, create a LeagueTesterYourLastName class. Create five different teams.

Print each of the classes using your method that you created - not the toString( )

Create an ArrayList of your teams. Print them (using the method you created) using an enhanced for loop.

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 Databases Questions!