Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write in DR JAVA *In DR JAVA* Objective: Create a game of video poker with a gra

ID: 3720316 • Letter: W

Question

Write in DR JAVA

*In DR JAVA* Objective: Create a game of video poker with a graphical user interface (GUI). The player should start with $100, and then the system deals out 5 playing cards. After the player sees the cards they are then asked to wager S10, $20, S50, or $100. Next the user picks which cards they wish to throw away, and then the system deals more cards in their place. Once this has concluded money are awarded by these criteria: . Nothing - Player loses their wager .Pair Player gets back their wager Two Pair- Player wins wager x 2 . 3 of a kind - Payer wins wager x 3 .Full House Player wins wagerx 6 .Flush-Player wins wager x 10 . Straight Player wins wager x 15 . 4 of a kind - Player wins wager x 20 Royal Flush - Player wins wager x 100 If the player's cash is less than or equal to 0 the game is over, and they restart with S100. Also once they close the program it should store the score in a file that once they restart it they begin with the score they once had.

Explanation / Answer

/** * PokerHand.java * This is code for a class that represents a Poker Hand. It is * useful for a draw poker game in which the hand is made up of * 5 cards. The ranks are as follows: 9 - Royal Flush; 8 - Straight * Flush; 7 - Four of a Kind; 6 - Full House; 5 - Flush; 4 - Straight; * 3 - Three of a Kind; 2 - Two Pair; 1 - Pair; 0 - Bust (nothing) */ public class PokerHand { private Card [] hand; private int rank; /** * PokerHand(Card c1, Card c2, Card c3, Card c4, Card c5) * Input: 5 Card objects that will make up the poker hand * Output: none * Description: Creates a PokerHand object with the 5 cards * passed in as parameters. It uses the evalRank() method * to give assign a rank to the hand. */ public PokerHand(Card c1, Card c2, Card c3, Card c4, Card c5) { hand = new Card[5]; hand[0] = c1; hand[1] = c2; hand[2] = c3; hand[3] = c4; hand[4] = c5; evalRank(); }//end Constructor /** * PokerHand() * Input: none * Output: none * Description: Creates a random poker hand through a call to the * other poker hand constructor and the random Card constructor. */ public PokerHand() { this(new Card(), new Card(), new Card(), new Card(), new Card()); }//end Constructor /** * getRank() * Input: none * Output: an integer representing the rank of the card */ public int getRank() { return rank; }//end getRank /** * hasAce() * Input: none * Ouptut: boolean - true if hand has an ace, false otherwise * Description: A simple utility method used to determine whether * the hand has an ace or not */ public boolean hasAce() { for(int i = 0; i < 5; i++) if(hand[i].getRank() == 14) return true; return false; }//end hasAce /** * gameToString() * Input: none * Output: a String representation of the hand * Description: A method that is useful in the DrawPoker * game - prints out the hand numbered without printing * out the rank (the user should figure that out!) */ public String gameToString() { String result = new String(""); for(int i = 0; i
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote