Initial Commit

This commit is contained in:
2022-10-07 00:44:12 -03:00
commit 8ff85da81c
308 changed files with 10106 additions and 0 deletions

View File

@ -0,0 +1,31 @@
/**
* TankTrain class
* @author Isaac Shoebottom (3429069)
*/
public class TankTrain extends TrainCar {
double litres;
boolean hazardous;
/**
* The constructor for the tank train
* @param code The unique code for the tank train
* @param inspectionYr The year the train was last inspected
* @param litres The litres the train is carrying
* @param hazardous If the train is carrying hazardous materials
*/
TankTrain(String code, int inspectionYr, double litres, boolean hazardous) {
super(code, inspectionYr);
this.litres = litres;
this.hazardous = hazardous;
}
/**
* The income calculator specific to tank train
* @return The income of that train
*/
@Override
double calculateIncome() {
return (hazardous) ? litres*17 : litres*9.5;
}
}