Add Route to Vehicle
This is debatable since every Campgians has routes but is done to support all cases. Signed-off-by: HeshamTB <hishaminv@gmail.com>
This commit is contained in:
parent
f8b5e79187
commit
83cb6bcee7
@ -1,6 +1,7 @@
|
||||
public abstract class Vehicle {
|
||||
|
||||
private double vehicleSize;
|
||||
private Route route;
|
||||
|
||||
public Vehicle(double vehicleSize){
|
||||
setVehicleSize(vehicleSize);
|
||||
@ -9,6 +10,14 @@ public abstract class Vehicle {
|
||||
return vehicleSize;
|
||||
}
|
||||
|
||||
public Route getRoute() {
|
||||
return route;
|
||||
}
|
||||
|
||||
public void setRoute(Route route) {
|
||||
this.route = route;
|
||||
}
|
||||
|
||||
private void setVehicleSize(double vehicleSize) {
|
||||
if (vehicleSize <= 0) throw new IllegalArgumentException("Vehicle can not be negative in length!");
|
||||
else this.vehicleSize = vehicleSize;
|
||||
|
Loading…
Reference in New Issue
Block a user