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:
HeshamTB 2020-11-06 22:42:15 +03:00
parent f8b5e79187
commit 83cb6bcee7

View File

@ -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;