Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Please help with this assignment. Goal The goal of this assignment is to lean how to use interface and polymorphism. Tasks Your tasks are to

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Please help with this assignment. Goal The goal of this assignment is to lean how to use interface and polymorphism. Tasks Your tasks are to design and implement an application to calculate carbon footprints from buildings, cars, and bicycles. Create three small classes urelated 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 getCarhonFootprint method. Have each of your classes implement that interface, so that its getCarhonFootprint method calculates an appropriate carbon footprint for that class. Please visit these websites to lean about carbon footprint and how to calculate from the following websites: /ecience.howstuffworks.com/e e/carbon https-fcarbonfund orghow-we-calculate bon Write an application that creates objects of each of the three classes, places references to those objects in AraylistarbonFootprint?, then iterates through the Array- List, polymorphically invoking each object's getCarbonEootprint method. For each object, print some identifying information and the object's carbon footprint. The attributes that are used to calculate the carbon footprints must be reasonable, but the values of those attributes do not need to be precise. In your test program, while iterating elements in the object of Arraxlist-CarbonFootprintz- print the followings: Attribute names and the values of the attributes that will be used to calculate carbon footprint Formula to compute the carbon footprint or some descriptions about how you came up with the formula The units of carbon footprint (tons of carbon year, kilograms of carbon day, etc) .The results of the carbon footprints calculation . Any additional information you want to displajy If an element of the Arraist object is Car, print the year of the car. You will need to declare instance variable year for class Car and downcast the reference of CerbenFeomzint to Car as shown here in Figure 10.9: THIS IS FIGURE 10.9 iS FOR REFERENCE TO "you will need to declare instance variable year for class Car and downcast the reference of GarbooFeotprint to Car not the solution

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Practical Neo4j

Authors: Gregory Jordan

1st Edition

1484200225, 9781484200223

Students also viewed these Databases questions

Question

7. Explain the frequency of intercultural dating today.

Answered: 1 week ago

Question

1. Explain the 2nd world war. 2. Who is the father of history?

Answered: 1 week ago

Question

How do Excel Pivot Tables handle data from non OLAP databases?

Answered: 1 week ago