I am currently stuck in my project. The assignment is to create a BlackJack game, using println/outprints to visualize the actual game.
Currently i have defined the card values and types, in two Enums as following:
public enum Rank {
TWO("2"),
THREE("3"),
FOUR("4"),
FIVE("5"),
SIX("6"),
SEVEN("7"),
EIGHT("8"),
NINE("9"),
TEN("10"),
JACK("J"),
QUEEN("Q"),
KING("K"),
ACE("A");
public String symbol;
private Rank(String symbol)
{
this.symbol = symbol;
}
public String getSymbol()
{
return symbol;
}
}
public enum Suit
{
CLUB,DIAMOND,HEART,SPADES;
}
These are used in my Deck Class as following:
public class Deck
{
public Suit suit;
public Rank rank;
public Deck(Suit suit, Rank rank)
{
this.suit = suit;
this.rank = rank;
}
public Suit getSuit()
{
return this.suit;
}
public Rank getRank()
{
return this.rank;
}
}
I will use the deck class for my classes, Dealerhand, and PlayerHand.
My question is as following. i would like to be able to draw a random card from an array of cards with the values of an actual card game.
How would I go about making the actual array so that it functions with my Enums, and would I be better off using an arraylist?