Chapter 6: Deck Of Cards ADT

December 9th, 2016

Classwork:
Design and implement a class called Card that represents a standard playing card. Each card has a suit and a face value. A Card ADT represents a standard playing card.

Create a class called DeckOfCards that stores 52 objects of the Card class using ArrayList. Include methods to

  • Shuffle the deck. The shuffle method should assume a full deck.
  • Deal a card
  • Report the number of cards left in the deck
  • In addition:

  • Write the method “printForEach” to print all the cards in the deck using the “for-each” loop.
  • Write the method “printIterator” to print all the cards in the deck using the “ListIterator“.
  • Create a driver class with a main method that deals each card from a shuffled deck, printing each card as it is dealt.




  • 🃏