District report:

- Add best time to dist

Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
HeshamTB 2020-12-01 22:33:24 +03:00
parent ba02114562
commit 19291fbfe1
Signed by: Hesham
GPG Key ID: 74876157D199B09E
2 changed files with 4 additions and 2 deletions

View File

@ -539,13 +539,15 @@ public class MakkahCity {
private static String preSimulationReport() {
StringBuilder report = new StringBuilder();
report.append("******************************District details******************************\n");
report.append("District | Campaigns | Busses | Est. time to Arafat | Est. time to District \n");
report.append("District | Campaigns | Busses | Best time to Arafat | Best time to District \n");
for (int i = 0; i < campPerDistrict.length; i++) {
//Per District, i denotes district index
report.append(String.format("%-9s|",campPerDistrict[i].get(0).getHotelDistrict().name()));
report.append(String.format(" %-10d|",campPerDistrict[i].size()));
report.append(String.format(" %-7d|", busesInDistrict(District.values()[i])));
report.append(String.format(" %-20s|", getShortestRoute(campPerDistrict[i].get(0), Mashier.ARAFAT).getFastestTimeOfTravel(new Bus())));
report.append(String.format(" %-20s|", getShortestRoute(campPerDistrict[i].get(0), Mashier.MINA).getFastestTimeOfTravel(new Bus())));
//Calc values per dist here.
report.append("\n");

View File

@ -38,7 +38,7 @@ public class Route {
double totalLength = getTotalLength();
int maxSpeed = vehicle.getMaxSpeed();
int totalTime = (int) (totalLength/maxSpeed);
String result = String.format("%2d:%2d",totalTime % 60, totalTime /60);
String result = String.format("%02d:%02d",totalTime / 60, totalTime % 60);
return result;
}