-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathDeckTester.java
57 lines (53 loc) · 2.48 KB
/
DeckTester.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
/*
* The purpose of this class is to create three new decks of cards and output their properties
* by calling methods from the Deck class
* Created by AP Developers
* Modified by Yolanda Yu
* Last modified on 06/06/2017
*/
public class DeckTester {
// This is the main method of the program that creates three decks and test
// all methods in the Deck class by outputting each deck's corresponding
// informations
public static void main(String[] args) {
String[] rankOne = { "3", "5", "7" };
String[] suitOne = { "Clubs", "Hearts" };
int[] valueOne = { 3, 5, 7 };
Deck deckOne = new Deck(rankOne, suitOne, valueOne);
System.out.println("DeckOne is empty: " + deckOne.isEmpty());
System.out.println("DeckOne size is: " + deckOne.size());
System.out.println("DeckOne dealt card is: " + deckOne.deal());
System.out.println();
System.out.println(deckOne.toString());
System.out.println();
String[] rankTwo = { "Jack", "2", "4", "9" };
String[] suitTwo = { "Hearts", "Spades", "Clubs" };
int[] valueTwo = { 11, 2, 3, 9 };
Deck deckTwo = new Deck(rankTwo, suitTwo, valueTwo);
System.out.println("DeckTwo is empty: " + deckTwo.isEmpty());
System.out.println("DeckTwo size is: " + deckTwo.size());
System.out.println("DeckTwo dealt card is: " + deckTwo.deal());
System.out.println();
System.out.println(deckTwo.toString());
System.out.println();
String[] rankThree = { "8", "1", "King", "6", "Queen" };
String[] suitThree = { "Diamonds", "Clubs", "Hearts", "Spades" };
int[] valueThree = { 8, 1, 13, 6, 12 };
Deck deckThree = new Deck(rankThree, suitThree, valueThree);
System.out.println("DeckThree is empty: " + deckThree.isEmpty());
System.out.println("DeckThree size is: " + deckThree.size());
System.out.println("DeckThree dealt card is: " + deckThree.deal());
System.out.println();
System.out.println(deckThree.toString());
// Creates a standard 52 cards deck to test the shuffle method.
String[] rankFour = { "1", "2", "3", "4", "5", "6", "7", "8", "9",
"10", "Jack", "Queen", "King" };
String[] suitFour = { "Diamonds", "Clubs", "Hearts", "Spades" };
int[] valueFour = { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13 };
Deck deckFour = new Deck(rankFour, suitFour, valueFour);
System.out.println("DeckFour dealt card is: " + deckFour.deal());
System.out.println(deckFour.toString()); // Display the whole deck to
// test if shuffle has been
// correctly implemented
}
}