Question: Problem 1. (Class Card) The class Card should provide: Data members face and suit of type Face and Suit respectively. A constructor that receives a

Problem 1. (Class Card) The class Card should provide:

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.

You may use the following header file as a reference:

#ifndef CARD_H

#define CARD_H

#include

class Card {

public: static const size_t FACES{13}; // total number of faces

static const size_t SUITS{4}; // total number of suits

enum class Face {...}; // Complete this line

enum class Suit {...}; // Complete this line

Card(Face, Suit); // initialize face and suit

std::string toString() const; // returns a string representation of a Card

Face getFace() const { return face; }

Suit getSuit() const { return suit; }

private:

Face face;

Suit suit; static

const std::string faceNames[FACES];

static const std::string suitNames[SUITS]; };

#endif

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!