Fixed participating boats not outputting correctly

-toString method in Boat class now uses getValue
This commit is contained in:
David Wu
2017-03-26 19:12:58 +13:00
parent bd072af0c4
commit 24dec0bb2f
3 changed files with 4 additions and 4 deletions
+2 -2
View File
@@ -22,11 +22,11 @@ public class Constants {
public static final GPSCoordinate finishLineMarker2 = new GPSCoordinate(32.317257, -64.836260); public static final GPSCoordinate finishLineMarker2 = new GPSCoordinate(32.317257, -64.836260);
public static final BoatInRace[] OFFICIAL_AC35_COMPETITORS = new BoatInRace[] public static final BoatInRace[] OFFICIAL_AC35_COMPETITORS = new BoatInRace[]
{new BoatInRace("Oracle Team USA", 30.0, Color.BLUEVIOLET, "USA"), {new BoatInRace("Oracle Team USA", 30.0, Color.BLUEVIOLET, "Oracle"),
new BoatInRace("Land Rover BAR", 23.0, Color.BLACK, "BAR"), new BoatInRace("Land Rover BAR", 23.0, Color.BLACK, "BAR"),
new BoatInRace("SoftBank Team Japan", 27.0, Color.RED, "JAP"), new BoatInRace("SoftBank Team Japan", 27.0, Color.RED, "JAP"),
new BoatInRace("Groupama Team France", 25.0, Color.ORANGE, "FRN"), new BoatInRace("Groupama Team France", 25.0, Color.ORANGE, "FRN"),
new BoatInRace("Artemis Racing", 22.5, Color.DARKOLIVEGREEN, "ART"), new BoatInRace("Artemis Racing", 22.5, Color.DARKOLIVEGREEN, "ART"),
new BoatInRace("Emirates Team New Zealand", 62, Color.LIMEGREEN, "ENZ")}; new BoatInRace("Emirates Team New Zealand", 62, Color.LIMEGREEN, "ETNZ")};
} }
+1 -1
View File
@@ -54,7 +54,7 @@ public class Boat {
* @return Name of the boat. * @return Name of the boat.
*/ */
public String toString() { public String toString() {
return getName().toString(); return getName().getValue();
} }
/** /**
+1 -1
View File
@@ -96,7 +96,7 @@ public abstract class Race implements Runnable {
System.out.println("===================="); System.out.println("====================");
for (int i = 0; i < startingBoats.size(); i++) { for (int i = 0; i < startingBoats.size(); i++) {
if (startingBoats.get(i) != null) { if (startingBoats.get(i) != null) {
System.out.println(i + 1 + ". " + startingBoats.get(i).getName() + ", Speed: " System.out.println(i + 1 + ". " + startingBoats.get(i).toString() + ", Speed: "
+ Math.round(startingBoats.get(i).getVelocity() * 1.94384) + "kn"); + Math.round(startingBoats.get(i).getVelocity() * 1.94384) + "kn");
startingBoats.get(i).setCurrentLeg(legs.get(0)); startingBoats.get(i).setCurrentLeg(legs.get(0));
} }