Activity 4: Shuffle in the Deck Class

Introduction

You implemented a Deck class in Activity 2. It should be complete except for the shuffle method. In Activity 3, you implemented methods in the Shuffle class. Now we're going to put it together.


Exercises

  1. Implement the shuffle method in the Deck class using either the perfect shuffle or the selection shuffle algorithm from Activity 3. Note that the Deck constructor creates the deck and then calls the shuffle method that you're writing now. The shuffle method also needs to reset the value of size to indicate that all the cards can be dealt.
  2. In the DeckTester file, create a standard deck of 52 cards and test the shuffle method. Take advantage of the toString method.