[Solved]Java Could Please Help Implement Checkplayerhand Playgame Methods Videopoker Class Q37039030
Java.
Could you please help me implement thecheckPlayerHand() and playGame()methods in the VideoPoker class?






import java.util.*; Ref: Short Description and Poker rules Video poker is also known as draw poker. The dealer uses a 52-card deck, which is played fresh after each playerHand. The player is dealt one five-card poker playerHand After the first draw, which is automatic, you may hold any of the cards and draw k again to replace the cards that you haven ‘t chosen to hold k Your cards are compared to a table of winning combinations k The object is to get the best possible combination so that you earn the highest k payout on the bet you placed. k Winning Combination:s 1. Jacks or Better: a pair pays out only if the cards in the pair are Jacks Queens, Kings, or Aces. Lower pairs do not pay out. k 2. Two Pair: two sets of pairs of the same card denomination. k 3. Three of a Kind: three cards of the same denomination. 4. Straight: five consecutive denomination cards of different suit k 5. Flush: five non-consecutive denomination cards of the same suit. 6. Full House: a set of three cards of the same denomination plus a set of two cards of the same denomination 7. Four of a kind: four cards of the same denomination 8. Straight Flush: five consecutive denomination cards of the same suit 9. Royal Flush: five consecutive denomination cards of the same suit, starting from 10 and ending with an ace /* This is the video poker game class It uses Decks and Card objects to implement video poker game Do not modify any data fields or defined methods You may add new data fields and methods Note: You must implement defined methods public class VideoPoker // default constant values private static final int defaultBalance 100; private static final int numberCards-5; // default constant payout value and playerHand types private static final int inningMultipliers-11,2,5,10,15,20,25,50,250; private static final String] winningHands-t “Royal Pair”, “Two Pairs” , “Three of a Kind”, “Straight”, “Flush “Full House”, “Four of a Kind”, “Straight Flush”, “Royal Flush” ; use one deck of cards private Decks thisDeck; // holding current player 5-card hand, balance, bet private List<Card> playerHand; private int playerBalance; private int playerBet; /*default constructor, set balance-defaultBalance public VideoPoker() this(defaultBalance); constructor, set given balance * public VideoPoker(int balance) this.playerBalance- balance; try t thisDeck – new Decks(1); catch (Exception e) t System.out.println (e.getMessage)); /This display the pavaut table based on winningMultipliers and winningHands arrays private void showPayoutTable() System.out.println(“nn”; System.out.println( “Payout Table System.out.println5455545″); int size – winningMultipliers.length for (int i-size-1; i -0; i–) t Multiplier”; System. out. println (winningHands [í]+”t It”+winningMultipliers [i)) ; System.out.println(“Inn”); / Check current playerHand using winningMultipliers and winningHands arrays Must print yourHandType (default is “Sorry, you lost”) at the end of function This can be checked by testCheckHands() and main) method private void checkPlayerHand) // impLement this method okokokkkkkkkkkkkkkkkok k kekokokok add new private methods here kkkkxkkokkkokxkekekokkkokokokkkekkokokek xkkok public void playGame() /kk The main algorithm for single player poker game Steps: showPayoutTable() show balance, get bet verify bet value, update balance reset deck, shuffle deck, deal cards and display cards ask for positions of cards to keep get positions in one input line update cards check hands, display proper messages update balance if there is a pavaut if balance 0: end of program else ask if the player wants to play a new game if the answer is “no” end of program else showPayoutTable) if user wants to see it goto++ // implement this method okokkkokokokokkokkkokokkkkxxk do not modify testCheckPlayerHand() below it is used for testing checkPlayerHand() public void testCheckPlayerHand() playerHandnew ArrayListsCard>); // set Royal Flush playerHand.add(new Card(4,1) )); playerHand.add (new Card (4,10)); playerHand.add (new Card(4,12)); playerHand.add (new Card(4,11)); playerHand.add (new Card(4,13)); System.out.println (playerHand); checkPlayerHand (O; System.out.println(“- // set Straight Flush playerHand.set(0, new Card(4,9)); System.out.println (playerHand) checkPlayerHand(); System.out.println(” // set Straight playerHand.set (4, new Card(2,8)); System.out.println (playerHand); checkPlayerHand) System.out.println(” /set Flush playerHand.set (4, new Card(4,5)); System.out.println (playerHand); checkPlayerHand(); System.out.println(“- // “Royal Pair””Two Pairs”,”Three of a Kind”, “Straight”, “Flush”, /”Full House”,”Four of a Kind”, “Straight Flush”, “Royal Flush” //set Four of a Kind playerHand.clear); playerHand.add (new Card(4,8)); playerHand.add (new Card(1,8)); playerHand.add (new Card(4,12)); playerHand.add (new Card(2,8)); playerHand.add (new Card(3,8)); System.out.println (playerHand); checkPlayerHand ); System.out.println(” // set Three of a Kind playerHand.set (4, new Card(4,11)); System.out.println (playerHand); checkPlayerHand ); System.out.println(” //set Full House playerHand.set (2, new Card(2,11)) System.out.println (playerHand); checkPlayerHand ); System.out.println(” /set Two Pairs playerHand.set(1, new Card(2,9)); System.out.println(playerHand); checkPlayerHand); System.out.println(” // set Royal Pair playerHand.set(0, new Card(2,3)); System.out.println(playerHand); checkPlayerHand ); System.out.println(” /non Royal Pair playerHand.set (2, new Card(4,3)) System.out.println (playerHand) checkPlayerHand(); System.out.println(” catch (Exception e) System.out.println(e.getMessage(O); Show transcribed image text import java.util.*; Ref: Short Description and Poker rules Video poker is also known as draw poker. The dealer uses a 52-card deck, which is played fresh after each playerHand. The player is dealt one five-card poker playerHand After the first draw, which is automatic, you may hold any of the cards and draw k again to replace the cards that you haven ‘t chosen to hold k Your cards are compared to a table of winning combinations k The object is to get the best possible combination so that you earn the highest k payout on the bet you placed. k Winning Combination:s 1. Jacks or Better: a pair pays out only if the cards in the pair are Jacks Queens, Kings, or Aces. Lower pairs do not pay out. k 2. Two Pair: two sets of pairs of the same card denomination. k 3. Three of a Kind: three cards of the same denomination. 4. Straight: five consecutive denomination cards of different suit k 5. Flush: five non-consecutive denomination cards of the same suit. 6. Full House: a set of three cards of the same denomination plus a set of two cards of the same denomination 7. Four of a kind: four cards of the same denomination 8. Straight Flush: five consecutive denomination cards of the same suit 9. Royal Flush: five consecutive denomination cards of the same suit, starting from 10 and ending with an ace /* This is the video poker game class It uses Decks and Card objects to implement video poker game Do not modify any data fields or defined methods You may add new data fields and methods Note: You must implement defined methods
public class VideoPoker // default constant values private static final int defaultBalance 100; private static final int numberCards-5; // default constant payout value and playerHand types private static final int inningMultipliers-11,2,5,10,15,20,25,50,250; private static final String] winningHands-t “Royal Pair”, “Two Pairs” , “Three of a Kind”, “Straight”, “Flush “Full House”, “Four of a Kind”, “Straight Flush”, “Royal Flush” ; use one deck of cards private Decks thisDeck; // holding current player 5-card hand, balance, bet private List playerHand; private int playerBalance; private int playerBet; /*default constructor, set balance-defaultBalance public VideoPoker() this(defaultBalance); constructor, set given balance * public VideoPoker(int balance) this.playerBalance- balance; try t thisDeck – new Decks(1); catch (Exception e) t System.out.println (e.getMessage));
/This display the pavaut table based on winningMultipliers and winningHands arrays private void showPayoutTable() System.out.println(“nn”; System.out.println( “Payout Table System.out.println5455545″); int size – winningMultipliers.length for (int i-size-1; i -0; i–) t Multiplier”; System. out. println (winningHands [í]+”t It”+winningMultipliers [i)) ; System.out.println(“Inn”);
/ Check current playerHand using winningMultipliers and winningHands arrays Must print yourHandType (default is “Sorry, you lost”) at the end of function This can be checked by testCheckHands() and main) method private void checkPlayerHand) // impLement this method okokokkkkkkkkkkkkkkkok k kekokokok add new private methods here kkkkxkkokkkokxkekekokkkokokokkkekkokokek xkkok public void playGame() /kk The main algorithm for single player poker game Steps: showPayoutTable() show balance, get bet verify bet value, update balance reset deck, shuffle deck, deal cards and display cards ask for positions of cards to keep get positions in one input line update cards check hands, display proper messages update balance if there is a pavaut if balance 0: end of program else ask if the player wants to play a new game if the answer is “no” end of program else showPayoutTable) if user wants to see it goto++ // implement this method
okokkkokokokokkokkkokokkkkxxk do not modify testCheckPlayerHand() below it is used for testing checkPlayerHand() public void testCheckPlayerHand() playerHandnew ArrayListsCard>); // set Royal Flush playerHand.add(new Card(4,1) )); playerHand.add (new Card (4,10)); playerHand.add (new Card(4,12)); playerHand.add (new Card(4,11)); playerHand.add (new Card(4,13)); System.out.println (playerHand); checkPlayerHand (O; System.out.println(“- // set Straight Flush playerHand.set(0, new Card(4,9)); System.out.println (playerHand) checkPlayerHand(); System.out.println(” // set Straight playerHand.set (4, new Card(2,8)); System.out.println (playerHand); checkPlayerHand) System.out.println(” /set Flush playerHand.set (4, new Card(4,5)); System.out.println (playerHand); checkPlayerHand(); System.out.println(“- // “Royal Pair””Two Pairs”,”Three of a Kind”, “Straight”, “Flush”, /”Full House”,”Four of a Kind”, “Straight Flush”, “Royal Flush”
//set Four of a Kind playerHand.clear); playerHand.add (new Card(4,8)); playerHand.add (new Card(1,8)); playerHand.add (new Card(4,12)); playerHand.add (new Card(2,8)); playerHand.add (new Card(3,8)); System.out.println (playerHand); checkPlayerHand ); System.out.println(” // set Three of a Kind playerHand.set (4, new Card(4,11)); System.out.println (playerHand); checkPlayerHand ); System.out.println(” //set Full House playerHand.set (2, new Card(2,11)) System.out.println (playerHand); checkPlayerHand ); System.out.println(” /set Two Pairs playerHand.set(1, new Card(2,9)); System.out.println(playerHand); checkPlayerHand); System.out.println(” // set Royal Pair playerHand.set(0, new Card(2,3)); System.out.println(playerHand); checkPlayerHand ); System.out.println(” /non Royal Pair playerHand.set (2, new Card(4,3)) System.out.println (playerHand) checkPlayerHand(); System.out.println(” catch (Exception e) System.out.println(e.getMessage(O);
Expert Answer
Answer to Java. Could you please help me implement the checkPlayerHand() and playGame() methods in the VideoPoker class?… . . .
OR

