implement color output

This commit is contained in:
HeshamTB 2020-11-26 21:29:04 +03:00
parent b214b279db
commit e8e45cb59e
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -472,12 +472,12 @@ public class MakkahCity {
"*********| District | Average Arrival | Avg. time\n"; "*********| District | Average Arrival | Avg. time\n";
StringBuilder report = new StringBuilder(); StringBuilder report = new StringBuilder();
report.append(String.format(headerFormat, currenttimeManager.getCurrentTime(), status)); report.append(String.format(headerFormat, currenttimeManager.getCurrentTime(), status));
String streetFormat = "%-18s | %%%-8s | %5d | %5d | %14d | %-9s"; String streetFormat = "%-27s | %%%-8s | %5d | %5d | %14d | %-9s";
String districtForamt = " | %-9s | %%%-14d | %s"; String districtForamt = " | %-9s | %%%-14d | %s";
for (int i = 0; i < stdStreet.length; i++) { for (int i = 0; i < stdStreet.length; i++) {
int cap = stdStreet[i].getPercentRemainingCapacity(); int cap = stdStreet[i].getPercentRemainingCapacity();
report.append(String.format(streetFormat, report.append(String.format(streetFormat,
stdStreet[i].getName().name(), getColoredStreetName(stdStreet[i], cap),
cap, cap,
stdStreet[i].getVehicles().size(), stdStreet[i].getVehicles().size(),
stdStreet[i].getNumberOfBuses(), stdStreet[i].getNumberOfBuses(),