Package model

Class Person

java.lang.Object
model.Person
Direct Known Subclasses:
Dealer, Player

public abstract class Person extends Object

Parent class of the Player and Dealer Objects.

Contains information about a person in a blackjack game, such as their name and hand.

Author:
Michael Neuper michael@michaelneuper.com
See Also:
  • Constructor Details

    • Person

      public Person()
      Constructs a Person object with an empty Hand and no name.
  • Method Details

    • getHand

      public Hand getHand()
      Returns the Hand of the Person.
      Returns:
      the Hand of the Person
    • setHand

      @Deprecated public void setHand(Hand hand)
      Deprecated.
      Sets the Hand of the Person.
      Parameters:
      hand - the Hand to set
    • getName

      public String getName()
      Returns the name of the Person.
      Returns:
      the name of the Person
    • setName

      public void setName(String name)
      Sets the name of the Person.
      Parameters:
      name - the name to set
    • hasBlackjack

      public boolean hasBlackjack()
      Checks if a Person has blackjack.
      Returns:
      true if the ArrayList has a blackjack, false otherwise
    • printHand

      public String printHand()
      Prints a formatted version of the person's Hand.
      Returns:
      a formatted String representing the person's Hand
    • printFilePath

      public String printFilePath(int i)
      Prints the file path of a Card at a given index
      Parameters:
      i - index of the Card
      Returns:
      file path of the Card at index i
    • hit

      public void hit(Deck deck, Deck discard)
      Draws a Card from the Deck and adds it to the person's Hand. If the Deck has no cards, the Deck is reloaded from the discard pile.
      Parameters:
      deck - the Deck to draw from
      discard - the discard pile to reload from if the Deck is empty