Question: Please follow the following statements: (UPLOAD Vehicle.java & Car.java & Bicycle.java & VehicleTest.java) a. Create an abstract class Vehicle including only one abstract method which

Please follow the following statements: (UPLOAD Vehicle.java & Car.java & Bicycle.java & VehicleTest.java)

a. Create an abstract class Vehicle including only one abstract method which is GetCarbonFootprint.

b. Create a subclass Car. A car has an instance variable gallon and a constructor. A cars carbon footprint is calculated by gallons *20.

c. Create another subclass Bicycle. A bicycles carbon footprint is 0.

d. Create a test class. Include a Vehicle array with a length of 2. The first element of it will be a car and the second element of it will be a bicycle.

e. Display carbon footprints of the car and bicycle by calling the method GetCarbonFootprint polyphormically.

Sample Output:

 Please follow the following statements: (UPLOAD Vehicle.java & Car.java & Bicycle.java

:\Java\assignments4306java VehicleTest Bicycle: 0 c Car that has used 40,00 gallons of gas: 800,00

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!