Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Java Code! War Cards. This is the Player class of the Code. I need help. public class Player { public Player(int id){} // Create the
Java Code! War Cards. This is the Player class of the Code. I need help. public class Player { public Player(int id){} // Create the player with their id. The pile's name should be "P1" or "P2" based on that id. Initially they are not the winner of the game. id is the player's id or name public void addCard(Card card){} // Add a single card to the bottom of the player's pile. card = the card to add. public void addCards(Pile cards){} // Add the collection of cards from the incoming pile to the bottom of player's pile, in order. Do not remove cards from the incoming pile! Use Pile's getCards() method to get the collection of cards to add. cards - the pile of cards to add to the player's deck/pile public boolean hasCard(){} //returns if there are cards in the player's pile public Card drawCard(){} //Remove a card from the top of the pile. The intention is the card should switch to be face up. The new card is removed from the top of the pile. public void setWinner(){} public boolean isWinner(){} //Declare the player to be winner. }
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