Question
C++ programming - Poker card analyzer Read description In C++ not Java or C For this project you are asked to write a program that
C++ programming - Poker card analyzer Read description
In C++ not Java or C For this project you are asked to write a program that can categorize a poker hand of 5 cards from a standard deck of cards. The following is a description of hands from highest to lowest: 1. Royal Flush The best possible hand is the combination of ten, jack, queen, king, ace, all of the same suit 2. Straight Flush Five cards of the same suit in sequential order 3. Four of a kind Any four numerically matching cards 4. Full house Combination of three of a kind and a pair in the same hand 5. Flush Five cards of the same suit, in any order 6. Straight Five cards of any suit, in sequential order 7. Three of a kind Any three numerically matching cards 8. Two pair Two different pairs in the same hand 9. One pair Any two numerically matching cards 10. High card The highest ranked card in your hand with an ace being the highest and two being the lowest.
The program will do the following:
1. Read a hand from the user and output the highest rank of the card. For example if the user entered the hand spade ace, heart ace, diamond 2, club 2, and heart 2; the program should print the hand and state that it is a full house. You may choose any appropriate way to get the user input. Make sure you provide clear directions to the user. 2. Draw random hands until you get a four of a kind or a better hand than a four of a kind, print the hand and the number of cards that were drawn to get the first hand that is a four of a kind or better. 3. Draw random hands until you get a full house or a better hand than a full house, print the hand and the number of cards that were drawn to get the first hand that is a full house or better. 4. Draw random hands until you get a pair or a better hand than a pair, print the hand and the number of cards that were drawn to get the first hand that is a pair or better. 5. Draw random hands until you get a straight (that is not a flush), print the hand and the number of cards that were drawn to get the straight.
Program Requirements: 1. You should have a class called Card that models a playing card. 2. You should have a class called Deck that models a deck of cards. This class should have a method that draws a random hand of 5 cards. You need to make sure that no repetition of the same card in a hand. Also make sure that you all cards are in the deck before you pick a hand for above 2, 3, and 4. (Obviously, if you are writing a poker game, you will not do this during one round of play.) 3. You should have a class called a hand that models a five card hand. This class should have methods to determine the highest rank of the hand. Make sure that you do not diagnose a straight flush as just a flush or a just a straight. For example, the hand that has 2, 3, 4, 5, and 6 of hearts is a straight flush. Another example: the hand that has three kings and two jacks is a full house not a pair or a three of a kind
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started