CarbonFootprint Interface: Polymorphism Using interfaces, you can specify similar behaviors for possibly disparate classes. Governments and companies worldwide are becoming increasingly concerned with carbon footprints (annual releases of carbon dioxide into the atmosphere) from buildings burning various types of fuels for heat, vehicles burning fuels for power, and the like. Many scientists blame these greenhouse gases for the phenomenon called global warming. Create three small classes unrelated by inheritance classes 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 prints out an appropriate message (e.g., this message from Building CarbonFoot).Write an application that creates objects of each of the three classes and one interface reference variable, assign each object to the interface reference variable, and then invoke each objects getCarbonFootprint method by means of dynamic method resolution. For each object, print a simple message (e.g., this message from Building CarbonFoot= 123 something).
Java
[Solved] CarbonFootprint Interface
$25
File Name: CarbonFootprint_Interface.zip
File Size: 235.5 KB
Only logged in customers who have purchased this product may leave a review.
Reviews
There are no reviews yet.