The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | Apr 2017 |
| Last Sign in: | 103 Weeks Ago, 2 Days Ago |
| Questions Answered: | 4870 |
| Tutorials Posted: | 4863 |
MBA IT, Mater in Science and Technology
Devry
Jul-1996 - Jul-2000
Professor
Devry University
Mar-2010 - Oct-2016
Objectives
Using enum types.
To be able to build an application using arrays and enum types
Â
Overview
The class PokerCard represents a common poker playing-card. In this implementation, the suit and rank of a playing-card are both represented by enum types, CardSuit and CardRank. You will implement 2 additional classes:
PokerDeck represents a deck of 52 PokerCards in 4 suits of 13 ranks each.
PokerHand represents a poker-hand of 5 PokerCards dealt from a PokerDeck.
Â
The required representation of PokerDeck is non-traditional. Instead of an array of 52 PokerCard elements, it uses an array of 52 boolean elements. Each element corresponds to one of the 52 poker playing-cards: true if that card is in the deck, false if that card is not in the deck. Each group of 13 consecutive elements represents the cards of one suit:
0Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 12 13Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 25 26Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 38 39Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â Â 51
|
CLUBS |
DIAMONDS |
HEARTS |
SPADES |
Within each suit, the array elements represent the playing-cards in rank order, thus:
|
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
T |
J |
Q |
K |
A |
Â
The PokerHand class is implemented using an array of 5 PokerCard elements.
Â
Specific Requirements
The PokerCard class is already implemented. A client to test it is provided. Run the client and study the PokerCard code until you fully understand the implementation.
Â
Complete the implementation of the PokerDeck class. A skeleton class with stubs of all the required methods is provided. Your implementation must
use the array representation described above,
use / and % to map an array index to CardSuit and CardRank ordinals,
use the ordinals to select from CardSuit.values() and CardRank.values() arrays.
A client to test your implementation is provided.
Â
Complete the implementation of the PokerHand class. A skeleton class is provided.
Your addCard() method must insert the PokerCard being added to maintain the PokerHand in sorted order.
Your type() method’s algorithm must utilize the sorted order of a PokerHand.
Your type() method’s implementation must use a helper method(s) for each hand-type being tested.
 A client to test your implementation is provided.
Document your program
Include a Program Id Paragraph into both source files
Provide helpful comments