Question: Use the methods developed in Exercise 7.16 to write an application that deals two five-card poker hands, evaluates each hand and determines which is better.
Use the methods developed in Exercise 7.16 to write an application that deals two five-card poker hands, evaluates each hand and determines which is better.
Exercise 7.16
Modify Fig.7.13 to deal a five-card poker hand. Then modify class DeckOfCards of Fig.7.12 to include methods that determine whether a hand contains
a) A pair
b) Two pairs
c) Three of a kind (e.g., three jacks)
d) Four of a kind (e.g., four aces)
e) A flush (i.e., all five cards of the same suit)
f) A straight (i.e., five cards of consecutive face values)
g) A full house (i.e., two cards of one face value and three cards of another face value)
Fig.7.13
Fig.7.12

I // Fig. 7.13: DeckOfCards Test.java // Card shuffling and dealing. 2 3 4 public class DeckOfCards Test { // execute application 5 6 7 8 9 10 II 12 13 14 15 16 17 18 19 20 } public static void main(String[]args) { DeckOfCards myDeckOfCards = new DeckOfCards (); myDeckOfCards.shuffle();// place Cards in random order } // print all 52 Cards in the order in which they are dealt for (int i 1; i
Step by Step Solution
3.38 Rating (160 Votes )
There are 3 Steps involved in it
To write an application that deals two fivecard poker hands and evaluates each hand to determine which is better using the methods developed in Exerci... View full answer
Get step-by-step solutions from verified subject matter experts
