Group: Members
Posts: 2,201
Joined: Nov 29 2007
Gold: 0.00
|
Enum is the key to success here.
public enum Rank { ONE, TWO, THREE; FOUR, FIVE, SIX, SEVEN, EIGHT, NINE, TEN, ACE, JACK, QUEEN, KING }; public enum Suit { HEART, SPADES, CLUB, DIAMOND }
Then just create a class Card that keeps a rank and a suit. A deck is obviously a list of cards, and each card got a rank and suit. The rest should be pretty simple to construct.
|