Problem

Create a class named PlayingCard, or use the class with the same name created in starting...

Create a class named PlayingCard, or use the class with the same name created in starting point. The class contains four fields—a value and suit in both numeric and string format (for example, 12 might be “Queen”) for a standard playing card. Each PlayingCard is assigned its values upon construction. Write a main()function that plays a card game where the objective is to have the greatest number of pairs; a pair is composed of two cards of the same value in different suits. Randomly deal five cards each to a player and to the computer. Make sure there are no duplicate cards, as would be the case using a standard playing card deck. (For example, a deck can contain four fives and 13 spades, but only one five of spades.) Count the number of matching cards for the player and for the computer, and announce a winner or a tie. For this game assume that a pair beats no matching cards, three of a kind beats a pair, four of a kind beats three of a kind, and five of a kind beats four of a kind. Card values do not affect the outcome—for example, two eights are no better than two sevens. Also assume two pairs are no better than a pair. Save the file as CardPairs.cpp.

Step-by-Step Solution

Request Professional Solution

Request Solution!

We need at least 10 more requests to produce the solution.

0 / 10 have requested this problem solution

The more requests, the faster the answer.

Request! (Login Required)


All students who have requested the solution will be notified once they are available.
Add your Solution
Textbook Solutions and Answers Search
ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT