-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayerTester.java
More file actions
62 lines (50 loc) · 1.96 KB
/
PlayerTester.java
File metadata and controls
62 lines (50 loc) · 1.96 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
/**
* PlayerTester.java
*
* @author Zachary, Anand, Jason (Group 7)
* Assignment #: Blackjack Project
*
*
*/
public class PlayerTester
{
/**
* @param String[] args the default parameter for main()
*
* Tests every method in class Player
*/
public static void main(String[] args)
{
Player p1 = new Player(); //constructor and initializeBankroll()
Dealer d1 = new Dealer();
System.out.println(p1.getBankroll()+"\n"); //tests bankroll getter method
System.out.println(p1.getDealerPlay()+"\n"+p1.getPlay()+"\n"+p1.getDoubleDown()+
"\n");
//tests boolean getter methods
p1.setPlay(false); //tests the setPlay method
System.out.println("boolean play set to false");
System.out.println(p1.getPlay()+"\n");
p1.reset(); //tests the reset method
System.out.println("play and dealer play variables reset");
System.out.println(p1.getDealerPlay()+"\n"+p1.getPlay()+"\n");
System.out.println(p1.getHand()+"\n"); //tests the getHand method
p1.betMoney(); //tests the betMoney method
System.out.println("\nPlayer bet: "+p1.getBet()+"\n"); //tests bet getter method
System.out.println(p1); //tests toString
p1.addToBankroll(1000); //tests addToBankroll
System.out.println(p1);
while(p1.getPlay() && !p1.isBusted() && p1.getHand().getHandSize() != 5 && !p1.getDoubleDown())
{
p1.playCards();
}
//tests playCards -- the method for player gameplay
//identical loop in the dealer method for gameplay
//the first two cards are not already added to player's hand
/*#
* Gets called once in this tester program
*/
System.out.println("\nPlayer busted: "+p1.isBusted());
//tests the bust method
System.out.println("End of tester program");
}
}