ou must write a function for each hand type. Each function must accept a const int array that contains HAND_SIZE integers, each representing one of the HAND_SIZE cards in the hand, and must return "true" if the hand contains the cards indicated by the name of the function, "false" if it does not. The functions must have the following prototypes. bool  containsPair(const int hand[]); bool  containsTwoPair(const int hand[]); bool  containsThreeOfaKind(const int hand[]); bool  containsStraight(const int hand[]); bool  containsFullHouse(const int hand[]); bool  containsFourOfaKind(const int hand[]);   Important! In the descriptions below, a pair is defined as exactly two of the same card. If there are more than two of the same card, that is not a pair. Similarly, a three-of-a-kind is defined as exactly three of the same card. If there are more than three of the same card, that is not a three-of-a-kind. However! Since there is no such hand as five-of-a-kind or more, four-of-a-kind must return true if there are four or more of the same card. // post:  returns true if and only if there are one or more pairs in the hand.  Note that // this function returns false if there are more than two of the same card (and no other pairs).   bool  containsPair(const int hand[]);   // post: returns true if and only if there are two or more pairs in the hand.   bool  containsTwoPair(const int hand[]);   // post: returns true if and only if there are one or more three-of-a-kind's in the hand.  bool  containsThreeOfaKind(const int hand[]);   // post: returns true if there are 5 consecutive cards in the hand. bool  containsStraight(const int hand[]);   // post: returns true if there is are one or more pairs and one or more three-of-a-kind's in the hand.   bool  containsFullHouse(const int hand[]);   // post: returns true if there are one or more four-of-a-kind's in the hand. bool  containsFourOfaKind(const int hand[]);   A hand that contains three-of-a-kind and two other different cards (for example, 1, 1, 1, 2, 3) should return "false" for "containsPair()" A hand that contains four-of-a-kind should return "false" for "containsPair()" and "containsThreeOfaKind()" A hand that contains a full-house should return "true" for containsThreeOfaKind() and containsPair(). A hand that contains two-pair should return "true" for containsPair(). 2) You do not need to write a containsHighCard function. All hands contain a highest card. If you determine that a particular hand is not one of the better hand types, then you know that it is a High Card hand. 3) Do not sort the cards in the hand. Also, do not make a copy of the hand and then sort that. 4) An important objective of this assignment is to have you practice creating excellent decomposition. Don't worry about efficiency on this assignment. Focus on excellent decomposition, which results in readable code. This is one of those programs where you can rush and get it done but end up with code that is really difficult to read, debug, modify, and re-use. If you think about it hard, you can think of really helpful ways in which to combine the tasks that the various functions are performing.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Additional Requirements

1) You must write a function for each hand type. Each function must accept a const int array that contains HAND_SIZE integers, each representing one of the HAND_SIZE cards in the hand, and must return "true" if the hand contains the cards indicated by the name of the function, "false" if it does not. The functions must have the following prototypes.

bool  containsPair(const int hand[]);

bool  containsTwoPair(const int hand[]);

bool  containsThreeOfaKind(const int hand[]);

bool  containsStraight(const int hand[]);

bool  containsFullHouse(const int hand[]);

bool  containsFourOfaKind(const int hand[]);

 

Important! In the descriptions below, a pair is defined as exactly two of the same card. If there are more than two of the same card, that is not a pair. Similarly, a three-of-a-kind is defined as exactly three of the same card. If there are more than three of the same card, that is not a three-of-a-kind. However! Since there is no such hand as five-of-a-kind or more, four-of-a-kind must return true if there are four or more of the same card.

// post:  returns true if and only if there are one or more pairs in the hand.  Note that

// this function returns false if there are more than two of the same card (and no other pairs).  

bool  containsPair(const int hand[]);

 

// post: returns true if and only if there are two or more pairs in the hand.  

bool  containsTwoPair(const int hand[]);

 

// post: returns true if and only if there are one or more three-of-a-kind's in the hand. 

bool  containsThreeOfaKind(const int hand[]);

 

// post: returns true if there are 5 consecutive cards in the hand.

bool  containsStraight(const int hand[]);

 

// post: returns true if there is are one or more pairs and one or more three-of-a-kind's in the hand.  

bool  containsFullHouse(const int hand[]);

 

// post: returns true if there are one or more four-of-a-kind's in the hand.

bool  containsFourOfaKind(const int hand[]);

 

  • A hand that contains three-of-a-kind and two other different cards (for example, 1, 1, 1, 2, 3) should return "false" for "containsPair()"
  • A hand that contains four-of-a-kind should return "false" for "containsPair()" and "containsThreeOfaKind()"
  • A hand that contains a full-house should return "true" for containsThreeOfaKind() and containsPair().
  • A hand that contains two-pair should return "true" for containsPair().

2) You do not need to write a containsHighCard function. All hands contain a highest card. If you determine that a particular hand is not one of the better hand types, then you know that it is a High Card hand.

3) Do not sort the cards in the hand. Also, do not make a copy of the hand and then sort that.

4) An important objective of this assignment is to have you practice creating excellent decomposition. Don't worry about efficiency on this assignment. Focus on excellent decomposition, which results in readable code. This is one of those programs where you can rush and get it done but end up with code that is really difficult to read, debug, modify, and re-use. If you think about it hard, you can think of really helpful ways in which to combine the tasks that the various functions are performing.

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 3 images

Blurred answer
Knowledge Booster
Array
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-engineering and related others by exploring similar questions and additional content below.
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY