-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTeamEvent.java
More file actions
33 lines (29 loc) · 763 Bytes
/
TeamEvent.java
File metadata and controls
33 lines (29 loc) · 763 Bytes
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
package WID_Classes;
import java.util.List;
public class TeamEvent extends Event {
public TeamEvent(String name) {
super(name);
}
public void addScore(List<Participant> team, int score, int index) {
//for (Participant p : team) {
super.addScore(team.get(index), score);
}
public int getScore(List<Participant> team) {
int sum = 0;
boolean valid = true;
for (Participant p : team) {
int score = super.getScore(p);
if (score >= 0) {
sum += score;
} else {
valid = false;
break;
}
}
if (valid) {
return sum;
} else {
return -1;
}
}
}