Question: Write the following program in Java. Create an abstract Vehicle class - Vehicle should have a float Speed and string Name, an abstract method Drive,

Write the following program in Java.

Create an abstract Vehicle class

- Vehicle should have a float Speed and string Name, an abstract method Drive, and include a constructor.

Create a Tesla class

- Tesla inherits from Vehicle.

- Tesla has an int Capacity.

- Include a constructor with the variables, and use super to set the parent class members.

- Override Drive to increase the speed by 1 each time.

- Add a toString to print the name, speed, and Capacity as shown:

Name: Model X

Speed: 1.0

Capacity: 100

Create a Client that does the following:

- Create a Tesla

- Drive it one time

- Print out the Name, Speed, Capacity

- Drive it one more time

- Print out the Name, Speed, Capacity again

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!