improved Vehicle output

This commit is contained in:
HeshamTB 2020-12-04 08:34:55 +03:00
parent 0e4f871770
commit 5f3488c4d0
Signed by: Hesham
GPG Key ID: 74876157D199B09E
2 changed files with 4 additions and 4 deletions

View File

@ -33,8 +33,8 @@ public class Bus extends CivilVehicle {
@Override
public String toString() {
StringBuilder s = new StringBuilder();
s.append(String.format("\nID: %s, Campaign ID: %s\n",this.getUID() , getCampaign().getUID()));
s.append(super.toString());
s.append(String.format("ID: %s, Campaign ID: %s\n",this.getUID() , getCampaign().getUID()));
return s.toString();
}

View File

@ -255,9 +255,9 @@ 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, Distance covered: %.1f, Progress: %s\n" +
"Arrived: %s Starting time: %s Arrive Time: %s, Trip time: %s\n",
super.toString(), this.route, streetString,
return String.format("\nRoute: %s\nStreet: %s, Location: %.1f, Distance covered: %.1f, Progress: %s\n" +
"Arrived: %s\nStarting time: %s\nArrive Time: %s\nTrip time: %s\n",
this.route, streetString,
this.getCurrentLocation(), this.totalDistanceTraveled, getProgress(), this.isArrivedToDest(),
this.getTimeStartedMoving(), this.getTimeOfArrival(), getTripTime());
}