Revert capacity()

This commit is contained in:
HeshamTB 2020-12-03 03:19:25 +03:00
parent 8bb64bea64
commit 787d2a7fd7
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -69,18 +69,18 @@ public class Street implements Travelable {
for(int i=0;i<vehicles.size();i++) {
totalLenthofCar+=vehicles.get(i).getVehicleSize();
}
// int percent = 0;
// if (totalLenthofCar > totalLength){
// percent = (int) (totalLength/totalLenthofCar);
// percent *= 100;
// percent += totalLength - (totalLength % totalLenthofCar);
// }
// else {
// percent = (int)(totalLength - totalLenthofCar);
// }
//
// return percent;
return totalLength - totalLenthofCar;
int percent = 0;
if (totalLenthofCar > totalLength){
percent = (int) (totalLength/totalLenthofCar);
percent *= 100;
percent += totalLength - (totalLength % totalLenthofCar);
}
else {
percent = (int)(totalLength - totalLenthofCar);
}
return percent;
//return totalLength - totalLenthofCar;
}
public int getPercentRemainingCapacity() {