Package model

Class Player


public class Player extends Person

Represents a player in a blackjack game. A player has a name and a hand of cards. They can take actions such as hitting, standing, and doubling down. They can also make bets and receive payouts.

This class extends the Person class, which contains shared methods and properties between players and dealers.

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

    • Player

      public Player()
      Constructs a new Player object with a default name of "Player".
  • Method Details

    • getBalance

      public double getBalance()
      Gets the player's current balance from a file. If a FileNotFoundException is thrown during the file reading process, it is caught and printed to the standard error stream.
      Returns:
      balance the player's current balance
    • setBalance

      public void setBalance(double balance)
      Sets the player's balance and stores it in a file. If a FileNotFoundException is thrown during the file reading process, it is caught and printed to the standard error stream.
      Parameters:
      balance - the new balance to set