add capcity method , canTakeVehicles , addVehicle
This commit is contained in:
parent
d63335beb8
commit
da8ef062ae
@ -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
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user