Hello, my professor wants me to initiate a deck of cards using two strings:
static String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"};
static String[] ranks = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace"};
I've never done anything like that before. If it was me, I would just specify
deck[52] = {'h2', 'h3', 'h4',}; //etc.
and spell out the elements of the array. Then I could do shuffling and all that. However, he has two strings - suits and ranks - and I'm not sure how to use those to initialize the deck.
static String[] suits = {"Spades", "Hearts", "Diamonds", "Clubs"};
static String[] ranks = {"2", "3", "4", "5", "6", "7", "8", "9", "10", "Jack", "Queen", "King", "Ace"};
I've never done anything like that before. If it was me, I would just specify
deck[52] = {'h2', 'h3', 'h4',}; //etc.
and spell out the elements of the array. Then I could do shuffling and all that. However, he has two strings - suits and ranks - and I'm not sure how to use those to initialize the deck.