-
Notifications
You must be signed in to change notification settings - Fork 1
/
VIPPlayer.java
58 lines (38 loc) · 1.86 KB
/
VIPPlayer.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
58
public class VIPPlayer extends Player{
public int initialMoney;
public String playerName;
public String idNumber;
public int totalBetAmount;
public VIPPlayer(String playerName, int initialMoney, String idNumber) {
super(1, Integer.parseInt(idNumber),initialMoney, playerName); // parent constructor
this.playerName = playerName;
this.idNumber = idNumber;
this.initialMoney = initialMoney;
}
public int vipCashBack() {
double cashBackDouble = .05 * totalBetAmount; // calculate cashback double
return (int) Math.round(cashBackDouble); // convert to int and return
}
@Override
public String printPlayer() {
String result = "";
if (count <= 0) {
int result1 = money - record;
System.out.println();
if (result1 > 0) {
System.out.println("---------Congratulations!---------:" +name+"\tPlayer ID:"+idNumber);;
result = "Total money won" + " $" + (result1 - count * initalMoney);//need to work on it after no 3 of gameMenu
} else if (result1 == 0) {
result = " did not win nor did lose.."; }
else {
result1 *= -1;
System.out.println("---------Better Luck next time!!--------- :"+name+"\tPlayer ID:"+idNumber);
result = "Total money lost by " + name + " is $" + (result1 + count * initalMoney);
}
}
System.out.println(" Housemoney because of " + name + ":$" + Game.houseMoney);
System.out.println();
return result;
// method toString
}
}