Question
Create three class Building, Auto and Food . Provide each class with instance variables that relate to them but not to the other classes. Provide
Create three class Building, Auto and Food .
Provide each class with instance variables that relate to them but not to the other classes.
Provide each class with accessor and mutator methods as well as at least one additional method that is unique to that class.
Provide additional instance variables related to calculating the Carbon Footprint (CO2 emmission) (Seehttp://shrinkthatfootprint.com/calculate-your-carbon-footprint for formula for each type).
The building only uses electricity and pays $0.25 per kilowatt hour.
Use the Vehicle calculation for Auto class
Food class
Include an instance field that describe the catagory of food.
Use the food catagory field to determine the emmission factor. .
Create an Interface called CarbonFootprint with one method getCarbonFootprint that returns a double representing the carbon footprint in pounds.
The three classes, Building, Auto and Food, must implement the CarbonFootprint Inteface.
Create a main application class Reads data from a file that contains the data required to create at least 3 instances of each of our three classes (so at least 9 object total)
The file format is left up to the developer but must be included in the submission.
Since the type and amount of data differ for each catagory, it may be wise to use the first field on a given line to identiy the catagory.
Create objects based on the data from the file and place those object in an Array of the CarbonFootprint Interface type.
Iterate through the array calling the getCarbonFootprint method polymorphically and the catagory and type of item such as:
My 2001 Toyota Camery carbon footprint is 14234.56 lbs per year.
An Apple's carbon footprint is 1238.22 lbs per year.
The remaining design details are left up to the developer, including how to structure the application, how many classes to develop and the interrelationship of those classes. Use the techniques you've learned in this course, including good object oriented design.
Create two UML Class Diagram for this project. The class diagrams should be created in at multiple iterations. 1. The first series of iterations should be done before you code and should provide a design that the code follows. (Design Version) 2. The second series of iterations should be completed after the code is complete and should reflex the EXACT class structure of you final program. (Final Version) 3. The class diagrams should include
1. Access specifier (- or +). 2. All instance fields with type. 3. All methods with return type and parameter types. 4. Associations, Generalization (Inheritance) and Aggregation and Multiplicity 5. Stereotyping Interface or Abstract Classes.
Design Version - completed prior to coding the project to assist with coding.
Final Version - completed after the coding that accurately represents the final version of the code, generally used for maintenance purposes.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started