Implemented leg class and added legs to the race

- #implement
This commit is contained in:
Michael Rausch
2017-03-06 17:56:07 +13:00
parent 597c1ae955
commit 9453307fd4
2 changed files with 59 additions and 1 deletions
+12 -1
View File
@@ -8,10 +8,12 @@ import java.util.List;
public class Race {
private ArrayList<Boat> boats;
private ArrayList<Leg> legs;
private int numberOfBoats = 0;
public Race(){
boats = new ArrayList<Boat>();
legs = new ArrayList<Leg>();
}
/*
@@ -71,7 +73,6 @@ public class Race {
/*
Prints the list of boats competing in the race
*/
public void displayStartingBoats(){
int numberOfBoats = this.getNumberOfBoats();
@@ -83,4 +84,14 @@ public class Race {
System.out.println(boats[i].getTeamName());
}
}
public void addLeg(Leg leg){
this.legs.add(leg);
}
public void printLegs(){
for (Leg leg : this.legs.toArray(new Leg[legs.size()])){
System.out.println(leg.getLabel());
}
}
}