Class BlackJackHand

java.lang.Object
  |
  +--BlackJackHand

public class BlackJackHand
extends Object


Field Summary
static int MAX_GOOD_VALUE
           
 
Constructor Summary
BlackJackHand()
          pre: none
post: creates an empty Hand
BlackJackHand(Card c)
          pre: c != null post: creates a Hand with one Card
 
Method Summary
 void addCard(Card c)
           
 boolean blackjack()
          pre: size() = 2 post: returns true if this hand is a Blackjack
 boolean busted()
          pre: none
post: returns true if this Hand's value is > 21
 int getValue()
           
 int size()
          pre: none
post: return number of cards in this Hand
 BlackJackHand split()
          pre: splittable() post: reduce this Hand to one card, and create a new Hand object with the other card
 boolean splittable()
          pre: size() = 2 post: returns true if this Hand can be legally spilt, that is the hand has size two and both cards are of equal value
 String toString()
          pre: none post: return a string version of the cards in this hand
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

MAX_GOOD_VALUE

public static final int MAX_GOOD_VALUE
See Also:
Constant Field Values
Constructor Detail

BlackJackHand

public BlackJackHand()
pre: none
post: creates an empty Hand


BlackJackHand

public BlackJackHand(Card c)
pre: c != null post: creates a Hand with one Card

Method Detail

addCard

public void addCard(Card c)

blackjack

public boolean blackjack()
pre: size() = 2 post: returns true if this hand is a Blackjack


busted

public boolean busted()
pre: none
post: returns true if this Hand's value is > 21


getValue

public int getValue()

size

public int size()
pre: none
post: return number of cards in this Hand


split

public BlackJackHand split()
pre: splittable() post: reduce this Hand to one card, and create a new Hand object with the other card


splittable

public boolean splittable()
pre: size() = 2 post: returns true if this Hand can be legally spilt, that is the hand has size two and both cards are of equal value


toString

public String toString()
pre: none post: return a string version of the cards in this hand

Overrides:
toString in class Object


Generated by BlueJ