Question: I can't figure out why this code wont compile and work public class DeckOfCards { private Card[] deckOfCards; // Represents the deck //Variable Declaration private

I can't figure out why this code wont compile and work

public class DeckOfCards { private Card[] deckOfCards; // Represents the deck //Variable Declaration private int dealtCards; private int remainingCards;

// No-arg/Default constructor public DeckOfCards() { deckOfCards = new Card[52]; // 52 card deck dealtCards = 0; remainingCards = 42; int count =0; int i,j; // Nested for loops for (i=1;i<=4;i++) { for (j=1;j<=13;j++) { deckOfCards[count++] = new Card(i,j); } } } public void shuffle() { Random randNum = new Random(); deckOfCards = new Card[52]; int count =0; while (count<=51) { int suit = randNum.nextInt(4)+1; // 1 to 4 int face = randNum.nextInt(13)+1; // 1 to 13 boolean result = false; for (int i =0; i

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!