Question: JAVA Create three small classes unrelated by inheritanceclasses Building, Car and Bicycle. Write an interface CarbonFootprint with a getCarbonFootprint method. Have each of your classes

JAVA Create three small classes unrelated by inheritanceclasses Building, Car and Bicycle. Write an interface CarbonFootprint with a getCarbonFootprint method. Have each of your classes implement that interface, so that its getCarbonFootprint method calculates an appropriate carbon footprint for that class. Each class should have a constructor that requires the data needed to calculate the carbon footprint. Write an application that creates objects of each of the three classes, places references to those objects in an array of type CarbonFootpint then iterates through the array polymorphically invoking each objects getCarbonFootprint method. For each object, print some identifying information and the objects carbon footprint.

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!