Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Card: Constructor: public Card (char suit, int rank) Suit is one of 'H', 'D', 'S', 'C' for hearts, diamonds, spades, and clubs, respectively. Rank should
Card: Constructor: public Card (char suit, int rank) Suit is one of 'H', 'D', 'S', 'C' for hearts, diamonds, spades, and clubs, respectively. Rank should be from 2 - 14. Ranks 11-14 are Jack, Queen, King, Ace respectively. You may assume cards are instantiated with valid sensible arguments. That is, you need not check that the rank is in fact between 2-14, or that the suit is one of 'H', 'D', S', or 'C'. Methods: Your Card class should override (NOT overload!) equals(). We define two cards to be equal if they have the same rank. Your Card class should also override toString(). Format your output as follows: If rank is 4 and suit is 'C, return If rank is 12 and suit is 'H', return Etc 4 of Clubs" "Queen of Hearts" Note that face cards are printed using their name, not rank. Try to be clever - don't simply create a monstrous else/if ladder to check every combination. PokerHand Constructor: public PokerHand (Card[] cards) Assume cards is a correct poker hand. That is, it contains five cards with valid suit and rank
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started