Given the following interface, create a class named Tesla that implements the Car interface. public interface Car { public double speedUp(); public double slowDown(); public String returnCarName(); } Tesla should have the following: Member variable named ‘speed’ of type int Member variable named ‘carName’ of type String Default Constructor and Constructor that accepts the two member variables as arguments The default speed should be 0 The default car name should be ‘Model 3’ To increase the car’s speed, you increment speed by 1 To decrease the car’s speed, you decrement speed by 1 You only need to create the Tesla class. You do not have to use the interface and class in a working program.
Given the following interface, create a class named Tesla that implements the Car interface.
public interface Car
{
public double speedUp();
public double slowDown();
public String returnCarName();
}
Tesla should have the following: Member variable named ‘speed’ of type int Member variable named ‘carName’ of type String Default Constructor and Constructor that accepts the two member variables as arguments The default speed should be 0 The default car name should be ‘Model 3’ To increase the car’s speed, you increment speed by 1 To decrease the car’s speed, you decrement speed by 1 You only need to create the Tesla class.
You do not have to use the interface and class in a working program.
Trending now
This is a popular solution!
Step by step
Solved in 2 steps