Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Main topics: Multiple Classes Declaring / Using Instance Variables Driver Classes Program Specification: You are to write a Class Deck which emulates a full deck

Main topics: Multiple Classes
Declaring / Using Instance Variables
Driver Classes
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 cach suit. This of course makes for a total of 52 playing cards in the deck.
Mandatory Instance variable:
private boolean[] deck = new boolean[52];
Mandatory Instance 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 0,51
// to the cards described above.
image text in transcribed

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

Climate And Environmental Database Systems

Authors: Michael Lautenschlager ,Manfred Reinke

1st Edition

1461368332, 978-1461368335

More Books

Students also viewed these Databases questions

Question

1. Define and explain culture and its impact on your communication

Answered: 1 week ago