Campaign menu option
This commit is contained in:
parent
5f3488c4d0
commit
a106c5fc2f
@ -123,4 +123,13 @@ public class Campaign {
|
||||
public int getPercentArrived() {
|
||||
return ((numberOfAriivedBuses/vehicles.size()) *100);
|
||||
}
|
||||
|
||||
public String toString(){
|
||||
return String.format("ID: %s\n" +
|
||||
"District: %s\n" +
|
||||
"Bueses: %d, Arrived buses: %d\n",
|
||||
getUID(),
|
||||
getHotelDistrict().name(),
|
||||
getNumberOfBusses(), getNumberOfArrivedBuses());
|
||||
}
|
||||
}
|
||||
|
@ -229,7 +229,25 @@ public class MakkahCity {
|
||||
}
|
||||
|
||||
private static void showCampaign(Campaign campaign){
|
||||
|
||||
String choice = "";
|
||||
Scanner in = new Scanner(System.in);
|
||||
System.out.println("\n"+campaign.toString());
|
||||
System.out.println("\n"+campaign.getUID());
|
||||
System.out.println("---------------------------\n" +
|
||||
"[1] Details\n" +
|
||||
"[2] Select bus\n" +
|
||||
"[3] Get current Route\n" +
|
||||
"[4] Return");
|
||||
choice = in.next();
|
||||
if (choice.equals("1")) System.out.println(campaign.toString());
|
||||
if (choice.equals("2")){
|
||||
System.out.printf("Choose from 0 to %d", campaign.getNumberOfBusses());
|
||||
choice = in.next();
|
||||
showVehicle(campaign.getVehicles().get(Integer.parseInt(choice)));
|
||||
}
|
||||
if (choice.equals("3")) showRoute(campaign.getRoute());
|
||||
if (choice.equals("4")) return;
|
||||
showCampaign(campaign);
|
||||
}
|
||||
|
||||
private static void showStreet(Street street) {
|
||||
@ -252,6 +270,10 @@ public class MakkahCity {
|
||||
showStreet(street);
|
||||
}
|
||||
|
||||
private static void showRoute(Route route){
|
||||
System.out.println(route.toString());
|
||||
}
|
||||
|
||||
private static void clearDoneCivilVehicles() {
|
||||
//Clear civil cars from list
|
||||
for (int i = 0; i < listOfVehicles.size();){
|
||||
|
Loading…
Reference in New Issue
Block a user