/** * TestCards is a basic program to test the methods of the Card and CardSet * objects. Don't modify this program. Compare its output to the given output. * * @author Adam Smith * @version 1.0 */ public class TestCards { public static void main(String[] args) { // make a new set of cards CardSet hand = new CardSet(); System.out.println("Empty hand is: " +hand); // add 2 random Cards, and 3 specified ones hand.add(new Card()); hand.add(new Card()); hand.add(new Card(10, Card.SPADES)); hand.add(new Card(Card.QUEEN, Card.DIAMONDS)); hand.add(new Card(2, Card.CLUBS)); System.out.println("Hand of size " +hand.getSize()+ ": " +hand); // remove the first and last ones Card discard1 = hand.discard(0); Card discard2 = hand.discard(3); System.out.println("Discarded the " +discard1+ " and the " +discard2+ "."); System.out.println("Hand of size " +hand.getSize()+ ": " +hand); // test shuffling hand.shuffle(); System.out.println("Same hand, shuffled: " +hand); // make a standard deck CardSet deck = CardSet.makeStandardDeck(); System.out.println("\nHere's a full deck:"); System.out.println(deck); } }