Question
team class is public class Team { private String teamName; private static int totalNumOfTeams = 0; private Manager manager; private Player player; public Team(String teamName,
team 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
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