public class Ferrari extends Car{
private String engineType = "Electric";
private String gear = "manual";
private int maxSpeed = 340;
public Ferrari( int cylinder, int speed,String engineType, String gear) {
super(false, "prestigious 1:8 scale model ",
2, cylinder, 2, speed, 340);
this.engineType = engineType;
this.gear = gear;
}
public void setEngineType(String engineType) {
this.engineType = engineType;
}
public void setGear(String gear) {
this.gear = gear;
}
@Override
public String getModel() {
return super.getModel();
}
@Override
public void stopEngine(){
super.stopEngine();
}
@Override
public void startEngine(){
super.startEngine();
}
@Override
public int Accelerate(int acceleration,int maxSpeed) {
int speed = 0;
speed += acceleration;
if(getSpeed()+acceleration > 340)
{
System.out.println("Your Ferrari SF90 exceeds the limit "+this.maxSpeed);
}else if( acceleration <=0)
{
System.out.println("Invalid speed for acceleration ");
}super.Accelerate(acceleration,this.maxSpeed);
return getSpeed();
}
public int getMaxSpeed() {
return maxSpeed;
}
@Override
public void setSpeed(int speed,int maxSpeed) {
maxSpeed = this.maxSpeed;
super.setSpeed(speed,maxSpeed);
}
}