Hello, dear friend, you can consult us at any time if you have any questions, add WeChat: daixieit


COMSC 140 -> Object Oriented C++

Poker Project (120 POINTS)

CONCEPT: Inheritance


Due:

Implement a program that simulates a deck of playing cards playing poker. The classes will need methods to shuffle the deck and to deal one card at a time. Make sure that the functions rand and srand are used in the shuffle method. Use classes with inheritance. The client à main should be as small as possible.


The deck of cards has 52 cards. Each card will have a suit such as Hearts, Diamonds, Clubs and Spades. The deck of cards has 13 different ranks that start at 2, the lowest, and end with an Ace, the highest.


The user will specify the number of hands (2 – 7 ), with each hand containing 5 cards. Once all the hands have been dealt, the program will display the players name and the hand. Determine the poker winner based on the type of hand based on the rules of poker below from lowest to highest. Display the winners name with the type of hand.


no pair, 1 pair, 2 pair, 3 of a kind, straight, flush, full-house,

4 of a kind, straight flush, royal flush

Royal flush: A-K-Q-J-10, all the same suit

Straight flush: any five consecutive cards, all same suit

4 of a kind: four cards, same value (ex. four 7’s)

Full House: 3 of a kind and a pair

Flush: any five cards of the same suit

Straight: any 5 consecutive cards

3 of a kind: 3 cards, same value

2 pairs: two cards, same value and another two cards same value

1 pair: two cards same value

No pairs: 5 dissimilar cards


Extra Credit: (10 points)


Allow each player one time to discard from 1-5 cards and draw new cards from the deck. Then determine the winner of the game.


EXAMPLE OUTPUT:

The poker game output may look like the following:

Do you wish to play poker or quit (p or q)? p

How many players are playing? 2

Enter player name: Ben

Enter player name: Karina


Ben’s hand:

ten hearts

ace of spades

queen of hearts

three of hearts

ten of clubs

Peter has 1 pair.


Karina’s hand:

jack hearts

jack clubs

jack diamonds

jack spades

3 hearts

Karina has four of a kind.


Karina is the winner!!!!!!!