Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

More Books

Students also viewed these Databases questions

Question

What is human nature?

Answered: 1 week ago