Blackjack

com.amoebacode.blackjack.core
Class Card

java.lang.Object
  |
  +--com.amoebacode.blackjack.core.Card
All Implemented Interfaces:
ICard

class Card
extends java.lang.Object
implements ICard

Card represents a single playing card, tracking its value, suit, and score.

Version:
0.9
Author:
Jason Gurney

Field Summary
private  int score
          The score of the card (2, 3, 4, 5, 6, 7, 8, 9, 10, or 11)
private  char suit
          The suit of the card (C, D, H, or S)
private  char value
          The value of the card (2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, or A)
 
Constructor Summary
protected Card(char value, char suit, int score)
          Default protected constructor.
 
Method Summary
protected  int getHardScore()
          Returns the hard score of this card.
protected  int getScore()
          Returns the soft score of this card.
 char getSuit()
          Returns the suit of this card (C, D, H, or S).
 char getValue()
          Returns the value of this card (2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, or A).
protected  boolean isAce()
          Indicates whether this card is an ace.
 
Methods inherited from class java.lang.Object
, clone, equals, finalize, getClass, hashCode, notify, notifyAll, registerNatives, toString, wait, wait, wait
 

Field Detail

value

private char value
The value of the card (2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, or A)

suit

private char suit
The suit of the card (C, D, H, or S)

score

private int score
The score of the card (2, 3, 4, 5, 6, 7, 8, 9, 10, or 11)
Constructor Detail

Card

protected Card(char value,
               char suit,
               int score)
Default protected constructor.
Parameters:
value - the value of the card
suit - the suit of the card
score - the score of the card
Method Detail

getScore

protected int getScore()
Returns the soft score of this card.
Returns:
this card's soft score

getHardScore

protected int getHardScore()
Returns the hard score of this card.
Returns:
this card's hard score

isAce

protected boolean isAce()
Indicates whether this card is an ace.
Returns:
true if this card is an ace

getValue

public char getValue()
Description copied from interface: ICard
Returns the value of this card (2, 3, 4, 5, 6, 7, 8, 9, T, J, Q, K, or A).
Specified by:
getValue in interface ICard
See Also:
ICard.getValue()

getSuit

public char getSuit()
Description copied from interface: ICard
Returns the suit of this card (C, D, H, or S).
Specified by:
getSuit in interface ICard
See Also:
ICard.getSuit()

Blackjack

Copyright © 2002 amoebacode.com.