Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*
- * Deck class contains info about constant properties general to the
- * Card elements of all decks.
- */
- import java.util.Hashtable;
- public class Deck
- {
- private static final String[] SUITS = {
- "Clubs", "Diamonds", "Hearts", "Spades"
- };
- private static final String[] NAMES = {
- "Ace", "Two", "Three", "Four", "Five", "Six", "Seven",
- "Eight", "Nine", "Ten", "Jack", "Queen", "King"
- };
- private static final int[] POINTS = {
- 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 10, 10, 10
- };
- private static final Hashtable<String, Integer> CARDS =
- new Hashtable<String, Integer>();
- // constructor - loads CARDS Hashtable
- public Deck() {
- int lastI = NAMES.length;
- int lastJ = SUITS.length;
- for (int i = 0; i < lastI; i++) {
- for (int j = 0; j < lastJ; j++) {
- String key = NAMES[ i ] + " of " + SUITS[ j ];
- Integer value = new Integer( POINTS[ i ]);
- CARDS.put( key, value);
- }
- }
- }
- public static String[] getNAMES() {
- return NAMES;
- }
- public static String[] getSUITS() {
- return SUITS;
- }
- public Hashtable<String, Integer> getCARDS() {
- return CARDS;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement