public class DeckOfCards
extends java.lang.Object
Constructor and Description |
---|
DeckOfCards()
This creates a deck of 52 cards.
|
Modifier and Type | Method and Description |
---|---|
void |
cut()
This method simulates cutting the deck.
|
Card |
draw()
This method simulates drawing a card from the top of the deck.
|
Card |
getCard(int index)
Reveals value of a card in the deck
|
boolean |
isEmpty()
Indicates if the deck is empty.
|
static void |
main(java.lang.String[] args) |
void |
placeOnBottom(Card c)
This method simulates placing a card on the bottom of the deck.
|
Card |
revealTopCard()
Reveals the top card of the deck.
|
void |
shuffle()
This method simulates shuffling the deck.
|
int |
size()
Indicates the number of cards in the deck
|
void |
sort()
This method sorts the deck by rank.
|
public DeckOfCards()
public Card draw()
public void placeOnBottom(Card c)
c
- the card to be placed on the bottom of the deck.
public void shuffle()
public void cut()
public void sort()
public boolean isEmpty()
public int size()
public Card revealTopCard()
public Card getCard(int index)
index
- specifies the position of the card where 0 is the bottom card and
size() - 1 is the top cardpublic static void main(java.lang.String[] args)