Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

team class is public class Team { private String teamName; private static int totalNumOfTeams = 0; private Manager manager; private Player player; public Team(String teamName,

image text in transcribedteam class is

public class Team {

private String teamName; private static int totalNumOfTeams = 0; private Manager manager; private Player player;

public Team(String teamName, Player player) { this.teamName = teamName; this.player = player; this.manager = null; totalNumOfTeams++; }

public String getTeamName() { return teamName; }

public static int getTotalNumOfTeams() { return totalNumOfTeams; }

public Player getPlayer() { return (player); }

public Manager getManager() { if (manager != null) { return (manager); } else { return (null); } }

public boolean hasManager() { if (manager == null) { return (false); } else { return (true); } }

public void setManager(Manager manager) { if (this.manager == null) { this.manager = manager; } else { System.out.println("This team already has a manager."); } }

public String toString() { String description = "Team[ name: " + teamName + ", player: " + player.toString() + ", manager: ";

if (manager != null) { description += manager.toString(); } else { description += "No Manager "; }

description += "]"; return (description); }

}

Class 4 - Tournament.java Team - int tournamenti - double prize - Team[ ] Teams - int numTeams Registered - final int MAX TEAMS REGISTERED = 8; + Tournament(int tournamentID , double prize) + int getTournamentID() + int getNum Teams Registered() + Team getTeam(int index) + Team[] getAllTeams() + void registerTeam(Team Team) + String toString() Methods Team constructor Initializes tournament id based on value passed Initializes tournament prize based on value passed Set numTeams Registered to 0 Create the array Teams of length MAX_TEAMS_REGISTERED (in this example, 8 ) getNumTeams Registered, getTournamentID Accessors for specified attributes register Team Adds a Team based on value passed if there is room. The Teams array is filled from start to end The number of Teams on board is incremented when a Team is added get Team Accessor for team at index getAllTeams Accessor for all teams to return an array of teams This needs to be done with no privacy leaks to String Returns String description of object (Format as shown in Example Output)

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

Sams Teach Yourself Beginning Databases In 24 Hours

Authors: Ryan Stephens, Ron Plew

1st Edition

067232492X, 978-0672324925

More Books

Students also viewed these Databases questions

Question

What is the best conclusion for Xbar Chart? UCL A X B C B A LCL

Answered: 1 week ago