Answered step by step
Verified Expert Solution
Question
1 Approved Answer
JAVA please use this started code to do the question package assignment2; import java.util.Random; public class Deck { public static String[] suitsInOrder = {clubs, diamonds,
JAVA please use this started code to do the question
package assignment2;
import java.util.Random;
public class Deck {
public static String[] suitsInOrder = {"clubs", "diamonds", "hearts", "spades"};
public static Random gen = new Random();
public int numOfCards; // contains the total number of cards in the deck
public Card head; // contains a pointer to the card on the top of the deck
/*
* TODO: Initializes a Deck object using the inputs provided
*/
public Deck(int numOfCardsPerSuit, int numOfSuits) {
/**** ADD CODE HERE ****/
}
/*
Deck.Deck(int numOf CardsPerSuit, int numOfSuits) : creates a deck with cards from Ace to numOf CardsPerSuit for the first numOf Suits in the class field suitsInOrder. The cards should be ordered first by suit, and then by rank. In addition to these cards, a red joker and a black joker are added to the bottom of the deck in this order. For example, with input 4 and 3, and suitsInOrder as specified in the file, the deck contains the following cards in this specific order: AC 2C 3C 4C AD 2D 3D 4D AH 2H 3H 4H RJ BJ The constructor should raise an IllegalArgumentException if the first input is not a number between 1 and 13 (both included) or the second input is not a number between 1 and the size of the class field suitsInOrder. Remember that a deck is a circular doubly linked list so make sure to set up all the pointers correctly, as well as the instance fieldsStep 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