Street capacity() calculation:

Add padding for each car except the first
	and last (i.e. number of cars - 2).
This commit is contained in:
HeshamTB 2020-11-09 12:42:32 +03:00
parent af5548734d
commit d3d515a818
Signed by: Hesham
GPG Key ID: 74876157D199B09E

View File

@ -46,7 +46,7 @@ public class Street {
for(int i=0;i<vehicles.size();i++) {
totalLenthofCar+=vehicles.get(i).getVehicleSize();
}
return totalLength -(totalLenthofCar + 0.5);
return totalLength -(totalLenthofCar + 0.5*(vehicles.size() - 2));
}
public boolean canTakeVehicles( Vehicle vehicle ) {