// Client program that prints out a Deck in reverse order import java.util.*; public class DeckClient { public static void main(String[] args) { List cards = new ArrayList(); cards.add(new Card("D", 1)); cards.add(new Card("H", 2)); cards.add(new Card("C", 3)); cards.add(new Card("S", 4)); Deck deck = new Deck(cards); reverseDeck(deck); } // Prints out the cards in deck in reverse order each on their own line, // with the top card appearing last and the bottom card appearing first. public static void reverseDeck(Deck deck) { // implicit base case if (deck.hasNextCard()) { Card card = deck.nextCard(); reverseDeck(deck); System.out.println(card); } } }