Answered step by step
Verified Expert Solution
Link Copied!

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

}

/*

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

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

Step: 3

blur-text-image

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

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions

Question

1. Who should participate and how will participants be recruited?

Answered: 1 week ago