Street: Add get remaining percent capacity()

This commit is contained in:
HeshamTB 2020-11-10 00:54:31 +03:00
parent 96a1254ce3
commit fc6b93697c
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -56,6 +56,10 @@ public class Street {
}
return totalLength -(totalLenthofCar + 0.5*(vehicles.size() - 2));
}
public int getPercentRemainingCapacity() {
return (int) (capcity()/(this.length*this.numberOfLanes))*100;
}
public boolean canTakeVehicles( Vehicle vehicle ) {
if ( vehicle.getVehicleSize() > capcity() )