Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Below I have a Constructor that creates a deck of cards: public Deck2(){ cardDeck = new Card2[numCards]; for(r=2;r <15;r++) { for(s = 1;s <5;s++) {
Below I have a Constructor that creates a deck of cards:
public Deck2(){ cardDeck = new Card2[numCards]; for(r=2;r<15;r++) { for(s = 1;s<5;s++) { int x = (r-3)+s; cardDeck[x]= new Card2(r,s); } } }
But i get this Output:
[2, 3, 4, 5, 6, 7, 8, 9, 10, J, Q, K, A, A, A, A, null, null, null, null, null, null,..]
any way i can modify the constructor to print all the cards
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started