-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPlayer.java
More file actions
52 lines (46 loc) · 1.33 KB
/
Copy pathPlayer.java
File metadata and controls
52 lines (46 loc) · 1.33 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
50
51
52
public class Player implements Comparable<Player> {
private String playerName;
private Integer noOfGoals;
private Double average;
public Player(String playerName, Integer noOfGoals, Double average) {
super();
this.playerName = playerName;
this.noOfGoals = noOfGoals;
this.average = average;
}
public String getPlayerName() {
return playerName;
}
public void setPlayerName(String playerName) {
this.playerName = playerName;
}
public Integer getNoOfGoals() {
return noOfGoals;
}
public void setNoOfGoals(Integer noOfGoals) {
this.noOfGoals = noOfGoals;
}
public Double getAverage() {
return average;
}
public void setAverage(Double average) {
this.average = average;
}
@Override
public String toString(){
return this.playerName;
}
@Override
public int compareTo(Player o) {
if (this.noOfGoals > o.noOfGoals) return -1;
if (this.noOfGoals < o.noOfGoals) return 1;
else{
if (this.average > o.average) return -1;
if (this.average < o.average) return 1;
else{
return (this.playerName.compareTo(o.playerName));
}
}
//return -1;
}
}