Question: This question is from Visual C# 2012 How to program 12.14 (CarbonFootprint Interface: Polymorphism) Using interfaces, as you learned in this chap- ter, you can
This question is from Visual C# 2012 How to program
12.14 (CarbonFootprint Interface: Polymorphism) Using interfaces, as you learned in this chap- ter, 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 inheritanceclasses Building, Car and Bicycle. Write an interface ICarbonFootprint with a GetCarbonFootprint method. Have each of your classes implement that interface, so that its GetCarbonFootprint method calculates an ap- propriate carbon footprint for that class (check out a few websites that explain how to calculate car- bon footprints). Write an app that creates objects of each of the three classes, places references to those objects in List
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
