Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help me understand how to do this. //card3.txt 11 6 H 3 S 4 S 7 S 5 S 9 S T S q

Please help me understand how to do this.

image text in transcribed

//card3.txt

11 6 H 3 S 4 S 7 S 5 S 9 S T S q s k s a H 2 H 3 H 5 H 2 C 5 S 8 H 9 H T H j h q h k h k D 2 D 3 D 4 D 5 D 6 D 6 S 6 c 5 s q d j d q C q S 5 C 6 C 8 C 9 C T C j c 2 c k c 2 S 2 h 2 D 4 H j s a D k d a C 5 S 6 S 2 S 3 S 4 S 

//sample.java

public class TwentySix { static String alphabet = "abcdefghijklmnopqrstuvwxyz"; void findErrors(String letters) { int ix, ax; String[] ltrs; String[] alpha = new String[26]; ltrs = letters.split(","); for (ix = 0; ix  

//Help

How to Rank a Poker Hand  1. count the frequency of each rank and each suit in the hand 2. set hand rank to nothing 3. examine the frequencies of the ranks for the following cases  a. only one frequency is greater than 1  i. f == 2 - one pair  ii. f == 3 - three of a kind  iii. f == 4 - four of a kind  b. two frequencies are greater than 1  i. f1 == 2 and f2 == 2 - two pair  ii. f1 == 3 and f2 == 2 (or vice versa) - full house  c. all frequencies are one  i. check for all five cards in a sequence - straight 4. examine the frequencies of the suits  a. one suit occurs 5 times  i. if the rank is nothing - flush  ii. if the rank is straight - straight flush 
In poker, a 5 card hand is ranked according to the highest of the following combinations of cards it contains. 0. Nothing the hand has none of the following combinations 1. One pair two of the cards have the same rank 2. Two Pair two of the cards have the same rank, and two of the other cards have the same rank which is different than the rank of the first pair 3. Three of a Kind three of the cards have the same rank 4. Straight the ranks of all 5 cards are in a sequence with no gaps (e.g. 7 8 9 10 J) (Ace is higher than King) 5. Flush the suits of all 5 cards are the same 6. Full House three of the cards have the same rank, and the remaining two cards also have the same rank 7. Four of a Kind four of the cards have the same rank 8. Straight Flush the ranks of all 5 cards are in a sequence and the suits are all the same For this assignment, write a PokerHand class (PokerHand.java) hose constructor accepts an array of 5 Cards (from the previous assignment), copies the cards into the Poker Hand instance, and ranks the hand The toString ethod of d should display the and and its rank see the example below) The attached file contains a number of poker hands, one hand per line. Each hand has five cards, each card is represented by two characters, as in the previous assignment. The first line in the file is a single number which is a count of the number of hands that follow The main0 ethod of PokerHand should read the hands, create an instance of PokerHand for each hand, and display it using PokerHand.toString0. Example output. 6 H 3 S 4 S 7 S 5 S Straight

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions