(JAVA HW) In the submarine class, over-load the turnOn andturnOff methods, so that the method can receive a time integer.
This is my code so far:
public class Vehicle {
//attributes
String color;
String model;
//constructor
public Vehicle(String color, String model) {
super();
this.color = color;
this.model = model;
}
//methods
public void turnOn(){
System.out.println(“The vehicle has been turned on”);
}
public void turnOff(){
System.out.println(“The vehicle has been turned off”);
}
}
public class Submarine extends Vehicle {
//attributes
int maxLoad;
int maxDepth;
//constructor
public Submarine(String color, String model, int maxLoad, intmaxDepth){
super(color,model);
this.maxLoad = maxLoad;
this.maxDepth = maxDepth;
}
//methods
public void turnOn(int time){
System.out.println(model + ” will be turned on in “+time+”minutes”);
}
public void turnOff(int time){
System.out.println(model + ” will be turned off in”+time+”minutes”);
}
public void descend(){
System.out.println(model+” has descended”);
}
public void useRadar(){
System.out.println(model+” has used
PayPal Gateway not configured
PayPal Gateway not configured