mirror of
https://github.com/michaelrausch/Party-Parrots-At-Sea.git
synced 2026-05-09 14:28:43 +00:00
Display the boats competing in the race
- Moved displayStartingBoats() and displayFinishingOrder() into the Race class - Display the competing boats when the application starts - #implement
This commit is contained in:
@@ -4,29 +4,16 @@ import java.util.ArrayList;
|
||||
|
||||
public class App
|
||||
{
|
||||
/*
|
||||
Displays the order in which the boats finished
|
||||
|
||||
@param race The current race
|
||||
*/
|
||||
public static void displayFinishingOrder(Race race){
|
||||
int numberOfBoats = race.getNumberOfBoats();
|
||||
Boat[] boats = race.getFinishedBoats();
|
||||
|
||||
System.out.println("--- Finishing Order ---");
|
||||
|
||||
for (int i = 0; i < numberOfBoats; i++) {
|
||||
System.out.println("#" + Integer.toString(i+1) + " - " + boats[i].getTeamName());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
public static void main( String[] args )
|
||||
{
|
||||
Race race = new Race();
|
||||
race.addBoat(new Boat("Team 1"));
|
||||
race.addBoat(new Boat("Team 2"));
|
||||
|
||||
displayFinishingOrder(race);
|
||||
race.displayStartingBoats();
|
||||
|
||||
System.out.println("");
|
||||
|
||||
race.displayFinishingOrder();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user