Question: In JAVA Using interfaces, you can specify similar behaviors for possibly disparate classes. Governments and companies worldwide are becoming increasingly concerned with carbon footprints (annual

In JAVAIn JAVA Using interfaces, you can specify similar behaviors for possibly disparate

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. Give each class some unique appropriate attributes and behaviors that it does not have in common with other classes. 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. Use the following measurements to calculate carbon footprints Bicycle: 0 pounds of CO2 Car: one gallon of gas yields 20 pounds of CO2 Building: Multiply the square footage by 50 for the wood frame, by 20 for the basement, by 47 for the concrete, and 17 for the steel Write an application that creates objects of each of the three classes, places references to those objects in ArrayList, then iterates through the Array-List, polymorphically invoking each object's getCarbonFootprint method. For each object, print some identifying information and the object's carbon footprint 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. Give each class some unique appropriate attributes and behaviors that it does not have in common with other classes. 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. Use the following measurements to calculate carbon footprints Bicycle: 0 pounds of CO2 Car: one gallon of gas yields 20 pounds of CO2 Building: Multiply the square footage by 50 for the wood frame, by 20 for the basement, by 47 for the concrete, and 17 for the steel Write an application that creates objects of each of the three classes, places references to those objects in ArrayList, then iterates through the Array-List, polymorphically invoking each object's getCarbonFootprint method. For each object, print some identifying information and the object's 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!