Question: 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 ****/

}

/*

image text in transcribed

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 fields

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!