-
Notifications
You must be signed in to change notification settings - Fork 0
/
Scania.java
31 lines (25 loc) · 1.19 KB
/
Scania.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
import java.awt.*;
/**
*Scania is a specific type of non-abstract {@link Truck} .
*/
public class Scania extends Truck {
private final static double MAX_TRUCK_BED_ANGLE = 70;
private final static double MIN_TRUCK_BED_ANGLE = 0;
/**
* Constructor given initial truck bed angle and will therefore set initial speed to 0.
*/
public Scania(double enginePower, Color color, String modelName, int nrDoors, double x, double y, Direction direction, double truckBedAngle, int weight) {
super(enginePower, 0, color, modelName, nrDoors, x, y, direction, MAX_TRUCK_BED_ANGLE, MIN_TRUCK_BED_ANGLE, weight);
setTruckBedAngle(truckBedAngle);
}
/**
* Constructor given initial speed and will therefore set the initial truck bed angle to the minimum truck bed angle.
*/
public Scania(double enginePower, double currentSpeed, Color color, String modelName, int nrDoors, double x, double y, Direction direction, int weight) {
super(enginePower, currentSpeed, color, modelName, nrDoors, x, y, direction, MAX_TRUCK_BED_ANGLE, MIN_TRUCK_BED_ANGLE, weight);
}
@Override
public double speedFactor(){
return getEnginePower() * 0.01;
}
}