-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathplayer.java
More file actions
49 lines (41 loc) · 1.08 KB
/
player.java
File metadata and controls
49 lines (41 loc) · 1.08 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
public class player {
private String[] pokes;
private int[] money;
private String[] names;
private int players;
public player() {
this(0);
}
public player(int x) {
this.pokes=new String[x];
this.money=new int[x];
this.names=new String[x];
for (int i=0; i<x; i++) {
this.pokes[i]="";
this.money[i]=1000;
this.names[i]="";
}
this.players=x;
}
public void addPoke(int player, String poke) {
this.pokes[player-1]=(this.pokes[player-1] + poke + " ");
}
public String getPokes(int player) {
return this.pokes[player-1];
}
public int getMoney(int player) {
return this.money[player-1];
}
public void subtract(int player, int cost) {
this.money[player-1]-=cost;
}
public void setName(int player, String name) {
this.names[player]=name;
}
public String getName(int player) {
return this.names[player-1];
}
public int getPlayers() {
return this.players;
}
}