Question
Develop a Java program that uses: File Processing Interfaces Project Overview: Government and organizations have become increasingly concerned with carbon footprint (annual releases of carbon
Develop a Java program that uses:
File Processing
Interfaces
Project Overview:
Government and organizations have become increasingly concerned with carbon footprint (annual releases of carbon dioxide in the atmosphere). Create a Java program that using Interfaces to calculates the carbon foot print of various objects, much often design is left up to the programmer however good object oriented design is required. As we learned Interfaces allow us to specify similar behavior for seemingly unrelated classes. We will use Interfaces in this project to link a building and automobile and food.
Project Requirements
Create three class Home, Auto and Food .
Provide each class with accessor and mutator methods.
Provide additional instance variables related to calculating the Carbon Footprint (CO2 emmission) (See http://www.carbonglobe.com/carbon-footprint-formula.php for formula for each type). Home ClassInstance variables
Catagory of home (Condo, private home, trailer etc)
Type of Fuel (Electric, Gas, Oil)
Average monthly cost
Cost per unit of full so either in per Kilowatt/Hour for electricity, per 1000 cubic feet for gas, or per gallon for oil)
Use type of fuel category field in a method to determine emission factor.
Vehicle ClassInstance variables
Make, model and year of vehicle (each its own instance variable)
Number of miles driven per week
Fuel efficiency in miles per gallon
Food class Instance variables
Name of food
Dollars spent on food
Category of food.
Use the food category field to in an method to determine the emission factor.
Create an Interface called CarbonFootprint with one method getCarbonFootprint that returns a double representing the carbon footprint in pounds.
The three classes,Home, 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 category, it may be wise to use the first field on a given line to identity the category.
Create objects based on the data from the file and place those object in an Array/ArrayList of the CarbonFootprint Interface type.
Iterate through the Array/ArrayList calling the getCarbonFootprint method polymorphically and the catagory and type of item such as:
My private home's carbon footprint is 20555.43 lbs per year.
My 2001 Toyota Camry's 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.
No need to include the class with main method in the UML diagrams. Refer to the UML Distilled pdf on the content page as a reference for creating class diagrams
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