added changeDirection routines, reorganized class file
This commit is contained in:
parent
b24f97e142
commit
027991097c
1 changed files with 26 additions and 19 deletions
45
Vehicle.java
45
Vehicle.java
|
@ -1,34 +1,41 @@
|
||||||
public class Vehicle {
|
public class Vehicle {
|
||||||
private int speed;
|
private int currentSpeed;
|
||||||
|
private int targetSpeed;
|
||||||
private double fuelLevel;
|
private double fuelLevel;
|
||||||
|
private int routeProgress;
|
||||||
|
Route currentRoute;
|
||||||
|
|
||||||
public void navigateRoute() {
|
public void setTargetSpeed(int newSpeed) {targetSpeed = newSpeed;}
|
||||||
|
public int getCurrentSpeed() {return currentSpeed;}
|
||||||
}
|
public double getFuelLevel() {return fuelLevel;}
|
||||||
|
|
||||||
public void setSpeed(int newSpeed) {
|
|
||||||
speed = newSpeed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getSpeed() {
|
|
||||||
return speed;
|
|
||||||
}
|
|
||||||
|
|
||||||
public double getFuelLevel() {
|
|
||||||
return fuelLevel;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void updateFuelLevel() {
|
public void updateFuelLevel() {
|
||||||
//would check fuel sensor and update accordingly
|
//would check fuel sensor and update accordingly
|
||||||
fuelLevel = 0.75;
|
fuelLevel = 0.75;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void changeDirection() {
|
public void navigateRoute() {
|
||||||
|
for (String[] el : currentRoute.getSelectedRouteSteps()) {
|
||||||
|
System.out.println("Start navigation");
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public void changeDirection(String direction) {
|
||||||
|
switch (direction) {
|
||||||
|
case "LEFT":
|
||||||
|
System.out.println("Turning left...");
|
||||||
|
break;
|
||||||
|
case "RIGHT":
|
||||||
|
System.out.println("Turning right...");
|
||||||
|
break;
|
||||||
|
case "STRAIGHT":
|
||||||
|
System.out.println("Continuing straight...");
|
||||||
|
break;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public void applyBrakes() {
|
public void applyBrakes() {
|
||||||
|
currentSpeed = currentSpeed - 5;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue