Class Card
java.lang.Object
Card
public class Card
- extends Object
|
Constructor Summary |
Card(int s,
int c)
Creates a card |
|
Method Summary |
boolean |
equals(Card c)
Determines if two cards have the same cardNum values. |
int |
getBlackJackValue()
Determines the Blackjack value of a card. |
String |
getCardName()
Converts the cardNum to a String value where
14 is Ace
13 is King
12 is Queen
11 is Jack
numbered cards are returned as the card number. |
int |
getOrder()
Returns the card number. |
String |
getSuitName()
Converts the suitNum to a string representing the suit. |
int |
getSuitValue()
Accessor that returns the suit value. |
boolean |
isAce()
Determines if a card is an Ace. |
boolean |
isFaceCard()
Determines if a card is a face card with cardNum values of 11-13
Face cards - Jack, Queen, and King. |
String |
toString()
Returns the card in the form of the card name and the suit. |
Card
public Card(int s,
int c)
- Creates a card
- Parameters:
s - the suit value (1-4)c - the card value (2-14)
2-two
3-three
...
10-ten
11-jack
12-queen
13-king
14-ace
equals
public boolean equals(Card c)
- Determines if two cards have the same cardNum values.
- Returns:
- true if the cardNum values are the same, false otherwise.
-
-
getBlackJackValue
public int getBlackJackValue()
- Determines the Blackjack value of a card. Face cards
have a value of 10, Ace is 11, and number cards are the
value of the number.
- Returns:
- card value in Blackjack
-
-
getCardName
public String getCardName()
- Converts the cardNum to a String value where
14 is Ace
13 is King
12 is Queen
11 is Jack
numbered cards are returned as the card number.
- Returns:
- String representation of the card
-
-
getOrder
public int getOrder()
- Returns the card number. A value between 2 and 14
14-Ace
13-King
12-Queen
11-Jack
10-Ten
...
2-Two
- Returns:
- A number between 2 and 14
-
-
getSuitName
public String getSuitName()
- Converts the suitNum to a string representing the suit.
- Returns:
- String representation of the suit.
-
-
getSuitValue
public int getSuitValue()
- Accessor that returns the suit value. Suit values 1-4
- Returns:
- suit value of the card which will represent
clubs, spades, hearts, and diamonds.
1-clubs
2-hearts
3-spades
4-clubs
-
-
isAce
public boolean isAce()
- Determines if a card is an Ace.
- Returns:
- true if the cardNum is a 14 which represents an Ace. false otherwise.
-
-
isFaceCard
public boolean isFaceCard()
- Determines if a card is a face card with cardNum values of 11-13
Face cards - Jack, Queen, and King.
- Returns:
- true if a face card. False otherwise.
-
-
toString
public String toString()
- Returns the card in the form of the card name and the suit.
Examples : Ace of Clubs or King of Spades
- Overrides:
toString in class Object
- Returns:
- Description of the card containing the name and suit.
-
-