enum faceValue{Two, Three, Four, Five, Six, Seven, Eight, Nine, Ten,
Jack, Queen, King, Ace};
enum suit{Clubs, Diamonds, Hearts, Spades};
class Card {
public:
Card(faceValue, Suit); // Constructor
Card(const Card&); // Copy constructor
const Card& operator=(const Card &); // Assignment operator
virtual ~Card(); // Destructor
int pointValue(); // What card is worth in blackjack
void display(); // display card
private:
Card(); // Default constructor
faceValue myValue; // face value of card
suit mySuit; // suit of card
// Note: if you choose, you may instead store the private data as:
// int myCard; // an integer from 1 to 52
// In this case, you'll have to change the constructor
};
class Deck {
public:
Deck(); // Default constructor
// Copy constructor
// Assignment operator
// Destructor
void init(); // Initialize the deck to contain the proper 52 cards
void shuffle(); // Put the cards in the deck in random order
void display(); // Display all cards in deck in order (for test/debug)
Card deal_one(); // Return the next card on the deck
private:
vector <Card> myCards;
// Note: you may also store the private data as an array of 52 Cards
// If you choose to do this, then you will have to add functions to
// the Card class to allow you to set a card's value
}
Additional classes:
BlackJack Hand:
member functions needed to do the following:
default constructor
Copy constructor
Assignment operator
Destructor
accept another card into the hand
return the best total point value in the hand
(highest possible point value that does not exceed 21)
display as player hand
display as dealer hand
reset hand
data members
vector of Cards
Dealer:
member functions needed to do the following:
default constuctor
constructor that lets you initialize a pointer to the Deck
Copy constructor
Assignment operator
Destructor
play hand (take cards until no longer allowed to hit)
possibly a bool function to tell whether or not Dealer has busted
reset hand
data members
Blackjack hand
pointer to the deck
Player:
default constructor
Copy constructor
Assignment operator
Destructor
play hand (take cards until user no longer wants to hit)
utility function to get input from user
possibly a bool function to tell whether or not player has busted
reset hand
data members
Blackjack hand
pointer to the deck