Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

JDBC Database Programming With J2ee

Authors: Art Taylor

1st Edition

0130453234, 978-0130453235

More Books

Students also viewed these Databases questions