added ex V
This commit is contained in:
28
src/exercises/ex_v/Result.java
Normal file
28
src/exercises/ex_v/Result.java
Normal file
@@ -0,0 +1,28 @@
|
||||
package exercises.ex_v;
|
||||
|
||||
public class Result implements Comparable<Result>{
|
||||
private final int time;
|
||||
private final String team;
|
||||
public Result(String team, int time) {
|
||||
this.time = time;
|
||||
this.team = team;
|
||||
}
|
||||
|
||||
public int getTime() {
|
||||
return time;
|
||||
}
|
||||
|
||||
public String getTeam() {
|
||||
return team;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int compareTo(Result result) {
|
||||
return this.getTime() - result.getTime();
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return getTeam() + " : " + getTime() + "h";
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user