Add distance to Vehicle toString()

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2020-12-02 17:43:05 +03:00
parent af92fb96e0
commit b6003cc3e8
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -233,10 +233,10 @@ public abstract class Vehicle {
Street st = this.currentStreet;
String streetString = "null";
if (st != null) streetString = st.getName().name();
return String.format("%s\nRoute: %s\nStreet: %s, Location: %.1f\n" +
return String.format("%s\nRoute: %s\nStreet: %s, Location: %.1f, Distance covered: %.1f\n" +
"Arrived: %s Starting time: %s Arrive Time: %s\n",
super.toString(), this.route, streetString,
this.getCurrentLocation(), this.isArrivedToDest(),
this.getCurrentLocation(),this.totalDistanceTraveled, this.isArrivedToDest(),
this.getTimeStartedMoving(), this.getTimeOfArrival());
}
}