Answered step by step
Verified Expert Solution
Question
1 Approved Answer
This is my Class Card but its not 100% correct. -My mutators should be private and handle invalid arguments. -Some of my instance methods should
This is my Class Card but its not 100% correct.
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, Quecan, King) in each suit. This of course makes for a total of 52 playing cards in the deck. Mundatory Instance variables: private Card[] deck = new Card [52] ; private int cardsDealt; Mandatory Instance methods: public Deck() // constructor // set each element of deck to a unique Card object, // and sets cardsDealt to zero. public int getCardsDealt( )// accessor // return the value of cardsDealt. private void setCardsDealt (int cardsDealt) // mutator // sets cardsDealt specified value (cardsDealt) public boolean isEmptyDeck () // returns wheather or not all the cards in deck // have already been dealt (cardsDealt =52 ). public void collectAllCards () // set cardsDealt to zero. public Card dealCard () // if emptyDeck() is false ... // returns the card at location cardsDealt in deck, // and increments cardsDealt by 1 . // else ,.. // returns null public void shuffleDeck () // apply 100 random card swaps within deck public void shuffleDeck (int swapCnt) // apply swapCnt randon card swaps within deck You are also to write a Driver Class DeckDriver to test your Deck class. Mandatory Functionality: Your driver class must minimally print all the cards in the deck in the random order that they are "dealt". Stuch as in Programs 1,2 , and 3 -My mutators should be private and handle invalid arguments.
-Some of my instance methods should be using the accessors/mutators
-And I'm supposed to use my toString() method
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started