Back to problems

Design a Card Class

Object-Oriented Programming · Amazon · Medium

Create a class that models a card deck. Its member method must select a card at random, and no selected card may appear again before the deck has no cards left. Function: Card drawCard(). Cards are identified by the integers 1 through 52, corresponding to a conventional deck. Example: A newly created deck contains [1, 2, 3, ..., 52]. One possible state after a draw is [31 (drawn), 2, 3, ..., 52]. Requirement: The deck must not be replenished until every card has been drawn.…

Checking your access…