Add UID for Sedan / SUV / Truck

This commit is contained in:
Asaad Dadoush 2020-11-14 16:31:43 +03:00
parent 52ac0c702a
commit 3e1b1f162c
3 changed files with 45 additions and 6 deletions

View File

@ -1,16 +1,29 @@
public class SUV extends CivilVehicle {
private String UID;
private static int numeberOfSUV;
private final int TIME_TO_FIX = 15; //in minutes
public static final int MAX_FORWARD = 1300;
public SUV(double vehicleSize){
super(vehicleSize);
generateUID();
}
public int getTimeToFix(){
return TIME_TO_FIX;
}
private void generateUID() {
numeberOfSUV++;
this.UID = String.format("SUV%04d", numeberOfSUV);
}
public String getUID(){
return this.UID;
}
}

View File

@ -1,14 +1,30 @@
public class Sedan extends CivilVehicle {
private String UID;
private static int numeberOfSedan;
private final int TIME_TO_FIX = 15; //in minutes
public static final int MAX_FORWARD = 1500; // Meter/Min
public Sedan(double vehicleSize){
super(vehicleSize);
generateUID();
}
public int getTimeToFix(){ return TIME_TO_FIX; }
@Override
public int getTimeToFix(){ return TIME_TO_FIX;
}
private void generateUID() {
numeberOfSedan++;
this.UID = String.format("Sedan%04d", numeberOfSedan);
}
public String getUID(){
return this.UID;
}
}

View File

@ -1,15 +1,25 @@
public class Truck extends CivilVehicle {
private String UID;
private static int numeberOfTruck;
private final int TIME_TO_FIX = 20; //in minutes
// public static final int MAX_FORWARD = ????; //TODO what is the speed here ??
public Truck(double vehicleSize){
super(vehicleSize);
generateUID();
}
public int getTimeToFix(){
return TIME_TO_FIX;
}
private void generateUID() {
numeberOfTruck++;
this.UID = String.format("Truck%04d", numeberOfTruck);
}
public String getUID(){
return this.UID;
}
}
}