Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

i need help writing th code for this assignment and also don't understand the new deck driver class that has to be made. below is

image text in transcribedimage text in transcribedi need help writing th code for this assignment and also don't understand the new deck driver class that has to be made. below is a portion of the code that may help

public class Program02 {

public static void main (String[]args) {

boolean[] myDeck = new boolean[52];

final int cardsPerRow = 8;

int cardsThisRow = 0;

int myCard;

initDeck(myDeck);

System.out.println(" Here is a shuffled deck ... ");

while (!emptyDeck(myDeck))

{

myCard = dealCard(myDeck);

++cardsThisRow;

if (cardsThisRow

{

printCard(myCard);

System.out.print(" ");

}

else {

System.out.println("");

cardsThisRow = 1;

printCard(myCard);

System.out.print(" ");

}

}

System.out.print(' ');

Program Specification: You are to write a Class Deck which emulates a full deck of playing cards. That is 4 suits (Clubs, Spades, Hearts, and Diamonds) and 13 ranks (Ace, 2, 3, 4, 5, 6, 7, 8, 9, Jack, Queen, King) in each suit. This of course makes for a total of 52 playing cards in the deck Mandatory Instance variable private boolean[] deck = new boolean [52]; MandatoryInstance and Class methods: public void initDeck) // set the values of deck to indicate that they are all // pressent - not delt yet. public boolean emptyDeck) // returns wheather or not all the cards in the deck // have already been delt. public int dealCard) // returns a card (an int in the range 0 to 51) at random // that has not been delt since the deck was initialize // via intDeck. Also notes (in deck) that this card is // no longer available. public static String cardToString(int card) // given a card (an int in the range 0 to 51) returns // an appropriate String repressentation of this card // based on a 1-1 and onto mapping of the set [O, 51] // to the cards described above. You are also to write a Driver Class DeckDriver to test your Deck clas Mandatory Functionalit Your driver class must minimally print all the cards in the deck in the random order that they are "dealt". Such as in Program 1. Rules and Requirements All access to the instance variable(s) in your deck classes' instance methods must be made via this

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

Moving Objects Databases

Authors: Ralf Hartmut Güting, Markus Schneider

1st Edition

0120887991, 978-0120887996

More Books

Students also viewed these Databases questions

Question

What is quality of work life ?

Answered: 1 week ago

Question

What is meant by Career Planning and development ?

Answered: 1 week ago

Question

What are Fringe Benefits ? List out some.

Answered: 1 week ago

Question

Summarize some human resource management training initiatives.

Answered: 1 week ago

Question

Summarize the training and development process.

Answered: 1 week ago

Question

Explain the concept of careers and career paths.

Answered: 1 week ago