Question: Please help. I am so confused. Code below. //card3.txt 11 6 H 3 S 4 S 7 S 5 S 9 S T S q

Please help. I am so confused. Code below.Please help. I am so confused. Code below. //card3.txt 11 6 H

//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

//Card.java

public static void main(String[] args) { String path = "/Users/mike/documents.card3.txt"; String data; String[] pairs; Card[] deck; Card card; File file = new File(path); FileInputStream inputStream; BufferedReader rdr = null; int ix, dx; try { deck = new Card[52]; inputStream = new FileInputStream(file); rdr = new BufferedReader(new InputStreamReader(inputStream)); while (null != (data = rdr.readLine())) { pairs = data.split(" "); for (ix = 0; ix   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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!