Write a program that deals a poker hand. Have it chooses five values between 1 a
ID: 3658291 • Letter: W
Question
Write a program that deals a poker hand. Have it chooses five values between 1 and 52 and displays a card corresponding to that value. Display a message to let the person know what kind of poker hand they have based on the Following: 1. Royal Flush-Ace, King, Queen, Jack, Ten all in the same suit 2. Straight Flush-Same suit in order (for example, jack, Ten, Nine, Eight, Seven of clubs) 3. Four of a kind-Example Four Fours 4. Full House-Three of one and two of another (for example, three fives and two eights) 5. Flush-All of the same suit 6. Straight-In order (for example, nine, eight, seven, six, five) 7. Three of a kind-Three of the same number 8. Two Pair-Two of one number and two of another number 9. One Pair-Two of the same number Below is what I have done, can someone help me what it work.Explanation / Answer
package javapoker; public class Card { private short rank, suit; private static String[] suits = { "hearts", "spades", "diamonds", "clubs" }; private static String[] ranks = { "Ace", "2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King" }; public static String rankAsString( int __rank ) { return ranks[__rank]; } Card(short suit, short rank) { this.rank=rank; this.suit=suit; } public @Override String toString() { return ranks[rank] + " of " + suits[suit]; } public short getRank() { return rank; } public short getSuit() { return suit; } }
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.