Question: public class Game { /** * This is the default constructors. * At most 10 player can play this game. * At most there are

 public class Game { /** * This is the default constructors.* At most 10 player can play this game. * At mostthere are 4 areas that players can play in. */ public Game() public class Game { /** * This is the default constructors. * At most 10 player can play this game. * At most there are 4 areas that players can play in. */ public Game() { } /** * This is the overloaded constructor for this class * @param player is an array containing all the players who entered the game. * @param map is the area that is available to the players to play. */ public Game (Player [] player, Map map) { } /** * This the copy constructor for this class * @param game is an object of Game, whose component is deeply copied into * the component of this object. */

public Game (Game game) { } /** * This is the getter method for the player list. * @return returns an array containing all the players of this game. */ public Player[] getPlayer() { return new Player[0]; } /** * This is the getter method for the map attribute. * @return Returns an object of map containing all the components of this game's map. */

public Map getMap() { return new Map(); } /** * This is the setter method for the player attribute, which deeply copies * the input parameter into the player attribute of this object. * @param player is an array of Player, whose elements are copied in the player attribute of this object. */ public void setPlayer(Player [] player) { } /** * This is the setter method for the map attribute, which deeply copies * the input parameter into the map attribute of this object. * @param map is an object of Map, whose attributes are copied in the map attribute of this object. */ public void setMap(Map map) { }

}

/** * * This class implements all a player requires to play in this game. * */ class Player { String name; Role role;

/** * This the default constructor for this class */ public Player() { } /** * This is the overloaded constructor for this class * @param name * @param role */ public Player(String name, Role role) { } /** * This is the copy constructor for this class * @param player */ public Player(Player player) { } /** * This is the getter method for attribute name * @return returns the value of attribute name */ public String getName() { return ""; } /** * This is the getter method for attribute role * @return returns the reference to attribute role. */ public Role getRole() { return new Role(); } /** * This is the setter method for attribute name * @param name is the value that is used to initialize name attribute */ public void setName(String name) { } /** * This is the setter method for attribute role * @param role is the object, whose reference is used to initialize attribute role. */ public void setRole(Role role) { / } } /** * This class implements the areas in which players can play. * */ class Map{ String theSkeld; String miraHq; String polus; String airShip; /** * This is the default constructor. */ public Map() { } /** * This is the overloaded constructor. * @param theSkeld is the first area in which player can play. * @param miraHq is the second area in which player can play. * @param polus is the third area in which player can play. * @param airShip is the fourth area in which player can play. */ public Map(String theSkeld, String miraHq, String polus, String airShip) { } /** * This is the copy constructor. * @param map is an object of Map that is used to initialize this object. */ public Map(Map map) { } } /** * * This class presents the role of the players, * which can be either imposter or crewmate. * Imposter role, gets the value of 'i'and * Cremate gets the value of 'c' * */ class Role{ char role; public Role() { } public Role(char role) { } public Role(Role role) { } public char getRole() { return ' '; } public void setRole(char role) { } }

One of the most popular multiplayer video games in 2020 was "among us". In this lab you are going to implement (a small part of) the backbone of this game, which is the objects and their relationships. Four to ten people can play this game, and each takes a role. A player can either be an imposter or a crewmate. The goal of the crewmates is to complete a set of tasks, while they identify the imposters and eliminate them. The goal of the imposters is to covertly kill the crewmate before they complete their tasks. Through a voting system, a player may be voted as an imposter and fired from the game. Crewmates will be the winner either if they complete all the tasks or eliminate all the imposters. Imposters will be the winner if the number of the crewmates in the game is the same as the imposters. The game has a science fiction theme with four areas in which players play the game. These areas are called "The Skeld", "MIRA HQ", "Polus" and "Airship". For this lab, you are going to implement the constructors, setter and getter methods for the classes that are shown in the UML below. It is important that the relationships (i.e. aggregations and composition) are implemented correctly. Please note that there are some methods in this UML that we are not asking you to implement. They are only there to make the objects more understandable and the relationship clearer. Player Role + name: String + role: Role + role: char + setRole(Role): void getRole(): Role + setName(String): void + getName(): String + setRole(char):void + getRole(): char + fixWire(): void + download(): String + maintain(String):void + kill(Player):Player Map Game -player: Player - map: Map +the Skeld: String + mira Ha: String + polus: String airShip: String + setPlayer(Player(i): void + getPlayer): Player[] + setMap(Map[]); void + getMapo: Mapli Task 1: implementing Role class For this task, you are required to implement the default, overloaded and copy constructor along with the setter and getter method. The full documentation of class and the methods can be found in the starter code. Task 2: implementing Map class For this class you only need to implement three constructors; the default, overloaded and copy constructor. Task 3: implementing Player class Three types of the constructors (default, overloaded and copy) and all the setter and getter methods is what we ask you to implement for this task. Task 4: implementing Game class Three types of the constructors (default, overloaded and copy) and all the setter and getter methods is what we ask you to implement for this task. Please note that the instance variables in this class are all private, as the UML shows

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!