Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Using c++ create a Class Card. The class Card should provide: Step 1: Data members face and suit of type Face and Suit respectively. A

Using c++ create a Class Card. The class Card should provide:

Step 1:

Data members face and suit of type Face and Suit respectively.

A constructor that receives a Face and Suit argument representing the face and suit of the card and uses them to initialize the data members.

Getter functions for the data members of the class.

Two scoped enumerations with typenames Face and Suit with enumeration constants representing the various suits and faces of each card.

Two static const arrays of std::strings representing the faces and suits. Note: The order of the array elements should match the order of the scoped enumeration constants.

Two static const size t variables representing the total number of faces and suits for a standard set of playing cards.

A toString function that returns the Card as a string in the form face of suit. You can use either the + operator to concatenation the std::strings or the std::ostringstream object for more efficient std::string concatenation.

Step 2:

(Class DeckOfCards) The class Card should provide:

An array of Cards named deck to store the Cards.

A default constructor that initializes the Cards in the deck.

A shuffle function that shuffles the Cards in the deck.

A dealCard function that removes a card from the deck and returns the removed Card

An isEmpty function that returns a bool value indicating whether the deck is empty.

Step 3 . (Class Hand) The class Hand should provide:

A std::array or std::vector of cards named hand to hold five cards of a poker hand

Two std::arrays name faceCount and suitCount which count the number of each face and suit in the hand.

A constructor which accepts a DeckOfCards object by reference. The constructor should draw five cards from the DeckOfCards object and update the faceCount and suitCount accordingly.

Member functions which check for a pair, two pair, three of a kind, four of a kind, a flush, or a straight. For example, bool pair() const should return true if hand has a pair and false otherwise.

A toString function that returns the cards in hand as a std::string.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

More Books

Students also viewed these Databases questions

Question

What do Dimensions represent in OLAP Cubes?

Answered: 1 week ago