Package Files

Class Player

java.lang.Object
Files.Player

public class Player extends Object
  • Constructor Summary

    Constructors
    Constructor
    Description
    Player(Integer playerNum)
    Constructor for Player object
  • Method Summary

    Modifier and Type
    Method
    Description
    boolean
    addCard(Deck deck)
    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
    Accesses the name of the player object
    Accesses the number associated with the Player object
    void
    Sets the player's name to the parameter passed in

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Player

      public Player(Integer playerNum)
      Constructor for Player object
      Parameters:
      String - name of the player
      Integer - number to identify the player
  • Method Details

    • setName

      public void setName(String name)
      Sets the player's name to the parameter passed in
      Parameters:
      name - String that you wish to set the player's name to
    • getNum

      public Integer getNum()
      Accesses the number associated with the Player object
      Returns:
      Integer Player Number
    • getName

      public String getName()
      Accesses the name of the player object
      Returns:
      Integer Player Name
    • addCard

      public boolean addCard(Deck deck)
      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.