Package Files
Class Player
java.lang.Object
Files.Player
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleanAdds a Card to hand Calls drawCard() from deck to get a random card Only adds a Card if hand has less than 5 Card objectsgetName()Accesses the name of the player objectgetNum()Accesses the number associated with the Player objectvoidSets the player's name to the parameter passed in
-
Constructor Details
-
Player
Constructor for Player object- Parameters:
String- name of the playerInteger- number to identify the player
-
-
Method Details
-
setName
Sets the player's name to the parameter passed in- Parameters:
name- String that you wish to set the player's name to
-
getNum
Accesses the number associated with the Player object- Returns:
- Integer Player Number
-
getName
Accesses the name of the player object- Returns:
- Integer Player Name
-
addCard
Adds a Card to hand Calls drawCard() from deck to get a random card Only adds a Card if hand has less than 5 Card objects- Parameters:
deck- Deck object that card is drawn from- Returns:
- boolean if card is added to the deck then return true; else return false.
-