You will construct two classes that represents an individual poker card and a complete 52 deck of cards. This lab is intended to prepare you for your next homework, so pay attention!
UML Diagram
Below is a UML diagram representing the required classes:
Card Class
We use the card class to represent an individual poker card. This includes:
Suit_t _suit
Suit_t is an enum that contains the four poker suits: Club, Diamond, Heart, Spade.
Rank_t _rank
Rank_t is an enum that contains all possible card ranks, e.g., 2-10, Jack, Queen, King, Ace.
Constructors
The card class has two constructors: a default constructor that sets the initial value of the card's suit to be Club and rank to be 2. The second constructor accepts a suit and rank as input parameters.
getSuit
Returns the card's Suit_t value in ENUM form.
getSuitName
Returns the card's Suit_t value in string form. E.g. "Ace" or "Clubs".
getRank
Returns the card's Rank_t in ENUM form.
getRankName
Returns the card's Rank_t value in string form. E.g. "Two", or "Jack".
Deck Class
The deck class will be used to represent a standard 52 card poker deck. This includes:
Card _cards[52]
This is an array of 52 unique cards.
int _used_indices[52]
This variable is used to track previously dealt cards. For example, assuming that _cards[0] represents the two of clubs, having putting a value of "1" inside _used_indices[0] could indicate that the two of clubs has been dealt and cannot be used again until the deck gets reshuffled.
Constructor
The Deck's constructor should initialize a fresh deck of 52 unique cards.
resetDeck
Calling this function will "zero out" _used_indices, which results in a fresh deck of cards.
getNextCard
This function will randomly select a card from _deck and return it to the user.
Download:- assign.pdf