Answer:
Required Java class is given below
Step-by-step explanation:
abstract class Vehicle{
double maxSpeed;
protected double currentSpeed;
//This is the constructor. For your informatin, abstract classes can't be initialized
public Vehicle(double maxSpeed){
this.maxSpeed = maxSpeed;
}
//This is an abstract method. This will be implemented in the class which extends this class
abstract void accelerate();
double currentSpeed(){
return this.currentSpeed;
}
double getMaxSpeed(){
return this.maxSpeed;
}
void pedalToTheMetal(){
//This loop runs as long as the currentSpeed is less than the max speed
while(currentSpeed<=maxSpeed){
accelerate();
}
}
}