-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathDeckTester.java
More file actions
83 lines (63 loc) · 2.38 KB
/
DeckTester.java
File metadata and controls
83 lines (63 loc) · 2.38 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
package Cards;
/**
* This is a class that tests the Deck class.
*/
public class DeckTester {
/**
* The main method in this class checks the Deck operations for consistency.
* @param args is not used.
*/
public static void main(String[] args) {
String[] ranks = {"jack", "queen", "king"};
String[] suits = {"spades", "hearts"};
int[] pointValues = {11, 12, 13};
Deck d = new Deck(ranks, suits, pointValues);
/*
System.out.println("**** Original Deck Methods ****");
System.out.println(" toString:\n" + d.toString());
System.out.println(" isEmpty: " + d.isEmpty());
System.out.println(" size: " + d.getSize());
System.out.println();
System.out.println();
System.out.println("**** Deal a Card ****");
System.out.println(" deal: " + d.deal());
System.out.println();
System.out.println();
System.out.println("**** Deck Methods After 1 Card Dealt ****");
System.out.println(" toString:\n" + d.toString());
System.out.println(" isEmpty: " + d.isEmpty());
System.out.println(" size: " + d.getSize());
System.out.println();
System.out.println();
System.out.println("**** Deal Remaining 5 Cards ****");
for (int i = 0; i < 5; i++) {
System.out.println(" deal: " + d.deal());
}
System.out.println();
System.out.println();
System.out.println("**** Deck Methods After All Cards Dealt ****");
System.out.println(" toString:\n" + d.toString());
System.out.println(" isEmpty: " + d.isEmpty());
System.out.println(" size: " + d.getSize());
System.out.println();
System.out.println();
System.out.println("**** Deal a Card From Empty Deck ****");
System.out.println(" deal: " + d.deal());
System.out.println();
System.out.println();
*/
String[] ranks1 = {"ace", "two", "three", "four", "five", "six", "seven", "eight", "nine", "ten", "jack", "queen", "king"};
String[] suits1 = {"spades", "hearts", "clubs", "diamonds"};
int[] pointValues1 = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13};
Deck d1 = new Deck(ranks1, suits1, pointValues1);
d1.deal();
System.out.println(d1.toString());
d1.shuffle();
System.out.println(d1.toString());
System.out.println("**** Deal Remaining all Cards ****");
for (int i = 0; i < 58; i++) {
System.out.println(" deal: " + d1.deal());
}
System.out.println(d1.toString());
}
}