Add distance to Vehicle toString()
Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
af92fb96e0
commit
b6003cc3e8
@ -233,10 +233,10 @@ public abstract class Vehicle {
|
|||||||
Street st = this.currentStreet;
|
Street st = this.currentStreet;
|
||||||
String streetString = "null";
|
String streetString = "null";
|
||||||
if (st != null) streetString = st.getName().name();
|
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",
|
"Arrived: %s Starting time: %s Arrive Time: %s\n",
|
||||||
super.toString(), this.route, streetString,
|
super.toString(), this.route, streetString,
|
||||||
this.getCurrentLocation(), this.isArrivedToDest(),
|
this.getCurrentLocation(),this.totalDistanceTraveled, this.isArrivedToDest(),
|
||||||
this.getTimeStartedMoving(), this.getTimeOfArrival());
|
this.getTimeStartedMoving(), this.getTimeOfArrival());
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user