-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathTeam.java
57 lines (45 loc) · 1.22 KB
/
Team.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
package rookCore;
/**
* Created by ashton on 12/31/14.
*/
public class Team {
Player playerOne, playerTwo;
private int gameScore;
private int roundScore;
public Team(Player playerOne, Player playerTwo) {
this.playerOne = playerOne;
this.playerTwo = playerTwo;
gameScore = 0;
roundScore = 0;
}
public int getRoundScore() {
return roundScore;
}
public void setRoundScore(int roundScore) {
this.roundScore = roundScore;
}
public int getGameScore() {
return gameScore;
}
public void setGameScore(int gameScore) {
this.gameScore = gameScore;
}
public String getPlayerNames() {
String s = playerOne.name + " & " + playerTwo.name;
return s;
}
public Player getPartner(Player p) {
if (p.equals(this.playerOne)) {
return this.playerTwo;
} else if (p.equals(this.playerTwo)) {
return this.playerOne;
}
throw new IllegalArgumentException("Player is not in this team");
}
public boolean contains(Player p) {
if (p.equals(this.playerOne) || p.equals(this.playerTwo)) {
return true;
}
return false;
}
}