Im trying to create a deck of cards using enums. I already have my enum declared, but I'm stuck in how exactly to create the deck of cards using a boolean array.
So far i tried to initialize my constructor, but I don't know what direction to take now. Any help would be greatly appreciated it. Thank you.
package Cards;
//Class to represent a standard Deck of 52 Playing-Cards
// The following functionality is provided
// Default Constructor - creates a complete deck of cards
// shuffle() - collects all 52 cards into the deck
// deal() - returns a randomly selected card from the deck
//
import java.util.Random;
public class DeckOfCards
{
public static final int DECK_SIZE = 52;
//Instance Variables
private boolean[] deck; //An implicit set of 52 Playing-Cards
private int cardsInDeck;//Number of cards currently in the deck
private Random dealer; //Used to randomly select a card to be dealt
//Constructor
public DeckOfCards()
{
deck = new boolean[ DECK_SIZE ];
for(PlayingCard.CardSuit suit : PlayingCard.CardSuit.values())
for(PlayingCard.CardRank rank : PlayingCard.CardRank.values())
deck[ cardsInDeck++ ] = true;
}
//Collect all 52 Playing-Cards into the deck
public void shuffle()
{
}
//Simulate dealing a randomly selected card from the deck
//Dealing from an empty deck results in a RuntimeException
public PlayingCard deal()
{
return null;
}