Question: 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.
 Main topics: Multiple Classes Declaring / Using Instance Variables Driver Classes

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!