Player Class Specification The Player class represents a player that will play a simple game. In this game, a player can play the number 0, 1, or 2. The Player class contains the following four fields: private String name; private int play; private int [] tally; private StringBuffer history; The Player class contains the following 2 constructors and 5 methods that you must implement: 1. Constructor with String parameter – If the argument is null, throw the IllegalArgumentException with the message "Invalid parameter", otherwise set the name field. Set play to 0, assign an int array to tally (you can decide the size of the array), and an empty StringBuffer to history. This constructor will be referred to as “the constructor” in the remainder of the text. 2. Copy Constructor – Make sure the copy is completely independent of the original with no shared fields. 3. getPlay – get method for the play field. 4. setPlay - If the argument is anything other than 0, 1, or 2 , throw the IllegalArgumentException with the message "Invalid parameter", otherwise set the play field. You are free to update other fields as you see fit in this method. 5. getHistory – returns the history of the player. The history will be each play followed by one space after the play(there will even be a space after the last play). For example, if the player plays a 2, followed by a 0, followed by a 1, the content of the history will be 2 0 1 Note: The history never contains the original 0 assigned as the default value of play using the constructor. Hint: Beware of a privacy leak. (Please do not post to piazza asking what is meant by a privacy leak. You should know this from the lectures) 6. reset – After this method is invoked on a player object, the player object should be in the same state as it would be if it was just constructed using the constructor. 7. getTally – Will return a string that represents the frequency of each play of the player. For example, the following: 0: ******** 1: ****** 2: ****** means the player has played 8 zeros (because there are 8 *), 6 ones, and 6 twos. See the sample driver for another example. PlayGame Class Specification The PlayGame class contains one static method, play, that allows 2 players to play the simple game. The rules are as follow: There are only 3 values that can be played: 0, 1, 2 In each round, each of the 2 player picks one of the three values. If both players, pick the same value, the round is a tie. A 2 beats a 1, a 1 beats a 0, and a 0 beats a 2 (this last rule is a little counter intuitive, so just to repeat, a player that picks a 0 will win over the player who picks a 2) The PlayGame class contains the following static method that you must implement: 1. play -This method will simulate 10 rounds of the game and return a string that shows the result of each round as well as the overall winner of the game (or report a tie). For each round, first set the play of player 1 then set the play of player 2. To get a value that is either 0,1,or 2, you must use the following call: random.nextInt(3) For each round, figure out who the winner is (it might be a tie) and concatenate the string you form to the string that the method will return. For example, the text for round 1 might be: Round 1 - P1: 0, P2: 1, result: P2 Wins See the Sample Driver output for more examples. Feel free to add private helper static methods to help you implement the necessary logic of who wins a round. After the 10 rounds, you need to have one additional line that reports the winner (whoever won the most game, or a tie if both have the same number of wins). For example, the text might be: P1 total: 2, P2 total: 3, Winner: P2 See the Sample Driver output for more examples.