Deck - /* / Deck.java Author: Lewis and Loftus / / Solution...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
//******************************************************************** // Deck.java Author: Lewis and Loftus // // Solution to Programming Project 6.9 //******************************************************************** / import java.util.Random; i public class Deck { private int numCards; private Card[] cards; private int NUM_CARDS = 52; //----------------------------------------------------------------- // Creates a deck, cards are created in order //----------------------------------------------------------------- public Deck() { numCards = NUM_CARDS; cards = new Card[numCards]; //create the deck (cards created in order) int cardIndex = 0; for (int face = Card.ACE; face <= Card.KING; face++) for (int suit = Card.CLUBS; suit <= Card.SPADES; suit++) cards[cardIndex++] = new Card(face, suit); } //----------------------------------------------------------------- // Deals a card from the deck //----------------------------------------------------------------- public Card deal() { if (numCards > 0)
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Image of page 2
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 05/17/2011 for the course COP 3530 taught by Professor Davis during the Spring '08 term at University of Florida.

Page1 / 2

Deck - /* / Deck.java Author: Lewis and Loftus / / Solution...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online