Ammar: Street.addVehicle() and capacity():
This commit is contained in:
parent
4dde706eda
commit
11252e7996
@ -42,7 +42,11 @@ public class Street {
|
|||||||
public double capcity() {
|
public double capcity() {
|
||||||
double totalLength = length * numberOfLanes;
|
double totalLength = length * numberOfLanes;
|
||||||
//TODO Ammar return (total length - (length of cars + padding))
|
//TODO Ammar return (total length - (length of cars + padding))
|
||||||
return 0;
|
double totalLenthofCar=0;
|
||||||
|
for(int i=0;i<vehicles.size();i++) {
|
||||||
|
totalLenthofCar+=vehicles.get(i).getVehicleSize();
|
||||||
|
}
|
||||||
|
return totalLength -(totalLenthofCar + 0.5);
|
||||||
}
|
}
|
||||||
|
|
||||||
public boolean canTakeVehicles( Vehicle vehicle ) {
|
public boolean canTakeVehicles( Vehicle vehicle ) {
|
||||||
@ -53,7 +57,12 @@ public class Street {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void addVehicle( Vehicle vehicle ) {
|
public void addVehicle( Vehicle vehicle ) {
|
||||||
//TODO Ammar
|
if(capcity()>0) {
|
||||||
|
for(int i=0;i<getVehicles().size();i++) {
|
||||||
|
addVehicle.set(i, getVehicles().get(i));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
//TODO Ammar i hope that
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user