add capcity method , canTakeVehicles , addVehicle

This commit is contained in:
Asaad Dadoush 2020-11-08 16:03:44 +03:00
parent d63335beb8
commit da8ef062ae

View File

@ -5,6 +5,7 @@ public class Street {
private double length;
private int numberOfLanes;
private ArrayList<Vehicle> vehicles;
public Street(double length, int numberOfLanes) {
setLength(length);
@ -37,4 +38,22 @@ public class Street {
public ArrayList<Vehicle> getVehicles() {
return vehicles;
}
public double capcity() {
double totalLength = length * numberOfLanes;
//TODO return (total length - (length of cars + padding))
return 0;
}
public boolean canTakeVehicles( Vehicle vehicle ) {
if ( vehicle.getVehicleSize() > capcity() )
return false;
else
return true;
}
/*
public void addVehicle( Vehicle vehicle ) {
//TODO
}
*/
}