|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||
java.lang.Object | +--Card
The Card class implements a basic card that can be used in various kinds of games. It represents the name, suit, and value of a card.
| Field Summary | |
static java.lang.String |
ACE
This value represents the card name "Ace" |
static java.lang.String |
CLUB
This value represents the card suit "Club" |
static java.lang.String |
DIAMOND
This value represents the card suit "Diamond" |
static java.lang.String |
EIGHT
This value represents the card name "Eight" |
static java.lang.String |
FIVE
This value represents the card name "Five" |
static java.lang.String |
FOUR
This value represents the card name "Four" |
static java.lang.String |
HEART
This value represents the card suit "Heart" |
static java.lang.String |
JACK
This value represents the card name "Jack" |
static java.lang.String |
KING
This value represents the card name "King" |
static java.lang.String |
NINE
This value represents the card name "Nine" |
static java.lang.String |
QUEEN
This value represents the card name "Queen" |
static java.lang.String |
SEVEN
This value represents the card name "Seven" |
static java.lang.String |
SIX
This value represents the card name "Six" |
static java.lang.String |
SPADE
This value represents the card suit "Spade" |
static java.lang.String |
TEN
This value represents the card name "Ten" |
static java.lang.String |
THREE
This value represents the card name "Three" |
static java.lang.String |
TWO
This value represents the card name "Two" |
| Constructor Summary | |
Card()
The no-argument constructor sets the Card's variables to default values. |
|
Card(java.lang.String cardName,
java.lang.String cardSuit)
This basic constructor sets the Card's name and suit. |
|
Card(java.lang.String cardName,
java.lang.String cardSuit,
int cardValue)
This constructor sets all the Card's parameters: name, suit, and value. |
|
| Method Summary | |
boolean |
equals(Card theOtherCard)
The public method equals checks whether two Cards have the same name and suit, and returns a boolean result. |
java.lang.String |
getName()
The public method getName returns the name of the Card. |
java.lang.String |
getSuit()
The public method getSuit returns the suit of the Card. |
int |
getValue()
The public method getValue returns the numeric value of the Card. |
void |
setName(java.lang.String cardName)
The public method setName sets the name of the Card. |
void |
setSuit(java.lang.String cardSuit)
The public method setSuit sets the suit of the Card. |
void |
setValue(int cardValue)
The public method setValue sets the numeric value of the Card. |
java.lang.String |
toString()
The public method toString returns the String representation of the Card, such as "Ace of Spades." |
| Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
| Field Detail |
public static final java.lang.String ACE
public static final java.lang.String TWO
public static final java.lang.String THREE
public static final java.lang.String FOUR
public static final java.lang.String FIVE
public static final java.lang.String SIX
public static final java.lang.String SEVEN
public static final java.lang.String EIGHT
public static final java.lang.String NINE
public static final java.lang.String TEN
public static final java.lang.String JACK
public static final java.lang.String QUEEN
public static final java.lang.String KING
public static final java.lang.String HEART
public static final java.lang.String SPADE
public static final java.lang.String DIAMOND
public static final java.lang.String CLUB
| Constructor Detail |
public Card()
public Card(java.lang.String cardName,
java.lang.String cardSuit)
cardName - the name of the Card as a String.cardSuit - the suit of the Card as a String.
public Card(java.lang.String cardName,
java.lang.String cardSuit,
int cardValue)
cardName - the name of the Card as a String.cardSuit - the suit of the Card as a String.cardValue - the value of the Card as an int.| Method Detail |
public java.lang.String getName()
public void setName(java.lang.String cardName)
cardName - the name of the Card as a String.public java.lang.String getSuit()
public void setSuit(java.lang.String cardSuit)
cardSuit - the suit of the Card as a String.public int getValue()
public void setValue(int cardValue)
cardValue - the numeric value of the Card as an int.public java.lang.String toString()
toString in class java.lang.Objectpublic boolean equals(Card theOtherCard)
theOtherCard - - the Card to be compared with this Card.
|
|||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||
| SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||