blob: aee4e66cc4e6ef1faa5ddeb5210befb5240862bf (
plain) (
blame)
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
|
package design.model.statistics;
import design.model.Golfer;
import design.model.Round;
public class LifetimeStats implements Statistics{
private final Golfer golfer;
public LifetimeStats(Golfer golfer){
this.golfer = golfer;
}
@Override
public Round[] getRounds(){
return golfer.getRounds();
}
@Override
public int get_score(){
int score = 0;
for(Round round : getRounds()){
score += round.getTotalSwings();
}
return score;
}
@Override
public double get_distance(){
double distance = 0;
for(Round round : getRounds()){
distance += round.getTotalDistance();
}
return distance;
}
}
|