-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathFootballClub.java
More file actions
39 lines (31 loc) · 972 Bytes
/
Copy pathFootballClub.java
File metadata and controls
39 lines (31 loc) · 972 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
34
35
36
37
38
39
import java.io.Serializable;
public class FootballClub extends SportsClub implements Comparable<FootballClub>, Serializable {
private int goalScored;
/*default constructor*/
public FootballClub(){
super();
this.goalScored = 0;
}
public FootballClub(String clubName, Address clubLocation ){
super(clubName,clubLocation);
}
public int getGoalScored(){
return this.goalScored;
}
public void setGoalScored(int goalScored){
this.goalScored += goalScored;
}
@Override
public String toString(){
return super.toString()+
"Goal Scored: "+this.goalScored+"\n";
}
@Override
public int compareTo(FootballClub footballClub){
if (this.getPoints() == footballClub.getPoints()){
return this.getGoalScored() - footballClub.getGoalScored();
}else{
return this.getPoints() - footballClub.getPoints();
}
}
}