Street capacity() calculation:
Add padding for each car except the first and last (i.e. number of cars - 2).
This commit is contained in:
parent
af5548734d
commit
d3d515a818
@ -46,7 +46,7 @@ public class Street {
|
|||||||
for(int i=0;i<vehicles.size();i++) {
|
for(int i=0;i<vehicles.size();i++) {
|
||||||
totalLenthofCar+=vehicles.get(i).getVehicleSize();
|
totalLenthofCar+=vehicles.get(i).getVehicleSize();
|
||||||
}
|
}
|
||||||
return totalLength -(totalLenthofCar + 0.5);
|
return totalLength -(totalLenthofCar + 0.5*(vehicles.size() - 2));
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canTakeVehicles( Vehicle vehicle ) {
|
public boolean canTakeVehicles( Vehicle vehicle ) {
|
||||||
|
Loading…
Reference in New Issue
Block a user