Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

In java please public class CarbonFootPrint{ /*Calculates the kilograms of CO2 emissions in a single year, based on some values related to car usage. Note

In java please

public class CarbonFootPrint{

/*Calculates the kilograms of CO2 emissions in a single year, based on some values related to car usage.

Note that the calculation is based on a year with 365 days.

Given that regular gasoline in North America produces 2.3 kgCO2 per litre, we have the

following formula for the kilograms of CO2 per year:

kgCO2 = 2.3 litresUsedPerYear

The number of litres used per year is given by:

litresUsedPerYear = 365 (kmPerDay fuelEfficiency)

where both kmPerDay varies per person and fuelEfficiency (measured in km/litre)

varies with the make of car

Parameters:

kmPerDay - The number of kilometers (on average) travelled by car in a day.

efficiency - The fuel efficiency of the car driven. Some average values based on car size (in litres/100km)are:

very small car: 7.1

small car 8.2

sports car 14.9

SUV 12.3

Returns:

The yearly kilograms of CO2 emissions for a single car.*/

public static double transportationFootprint(double kPD, double effic){

}

/*Calculates the kilograms of CO2 emissions in a single year, based on home electricity use.

The average Canadian household produces 0.257 kg of CO2 per kilowatt in a month. To

calculate the CO2 emissions for a year, we use the following:

kgCO2 = (kWhPerMonth 12 0.257) numPeopleInHome

where the kWhPerMonth is obtained from the electric bill.

Parameters:

kWhPerMonth - An average value of kilowatts used per month.

numPeople - The number of people who share in the electricity consumption, assuming that everyone uses the same amount.

Returns:

The yearly kilograms of CO2 emissions for a single electricity user.*/

public static double electricityFootprint(double kWhPerMonth, int num){

}

/*Calculates the kilograms of CO2 emissions in a single year, based on the percentages of types of food in a person's diet.

Note that this method does not check that the input all adds to 100%. It is assumed that the user can do the math.

A rough estimate is calculated based on the percentage of a persons consumption of meat

& fish, dairy, fruit & vegetables, and carbohydrates. The following formulae provide the

yearly footprint for these four categories. Note that percentages are usually expressed as

numbers between 0 and 100, but when inserted into calculations, they are actually between

0 and 1.

meat kgCO2 = (percent meat & fish) 53.1

dairy kgCO2 = (percent dairy) 13.8

fruit & veg kgCO2 = (percent fruits & veg) 7.6

carbs kgCO2 = (percent carbs) 3.1

A persons total food kgCO2 measurement is given by the sum of the above four values.

Parameters:

meat - The percentage of meat consumption (0 to 100).

dairy - The percentage of dairy consumption (0 to 100).

fruitVeggies - The percentage of fruit and vegetable consumption (0 to 100).

carbs - The percentage of carbohydrate consumption (0 to 100).

Returns:

The yearly kilograms of CO2 emissions for a single person based on their proportions of food groups.*/

public static double foodFootprint(double meat, double dairy, double fv, double carb){

}

/*Calculates the metric Tons (1 Ton = 1000 kilograms) of CO2 emissions in a single year, based on car travel,

electricity use, and percentage of food groups.

The total CO2 emissions are measured in metric tons (tCO2) per year:

tCO2 = (transportation footprint + electricity footprint + food footprint) 1000

Parameters:

transportation - The CO2 footprint, in kg, for a full year.

electricity - The CO2 footprint, in kg, for a full year.

food - The CO2 footprint, in kg, for a full year.

Returns:

The total yearly metric tons of CO2 emissions for a person.*/

public static double totalFootprint(double trans, double elec, double food){

}

/*Used as a unit tester. Prompts the user for the necessary information to calculate the various

values for a carbon footprint and prints out the results.

The main method will need to test each of the methods with some user values. Do this

with a single Scanner object that prompts the user for the required data and then add the

appropriate data to the argument list of the appropriate method. If you prefer, you may

create a separate method that performs the interface between the user and the methods and

then let this method be called from main.

Parameters:

args - Not used for this program*/

public static void main(String[] args){

}

}

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

Step: 3

blur-text-image

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

Intelligent Information And Database Systems 6th Asian Conference Aciids 2014 Bangkok Thailand April 7 9 2014 Proceedings Part I 9 2014 Proceedings Part 1 Lnai 8397

Authors: Ngoc-Thanh Nguyen ,Boonwat Attachoo ,Bogdan Trawinski ,Kulwadee Somboonviwat

2014th Edition

3319054759, 978-3319054759

More Books

Students also viewed these Databases questions

Question

Which form of proof do you find least persuasive? Why?

Answered: 1 week ago

Question

1. Identify the sources for this conflict.

Answered: 1 week ago

Question

3. The group answers the questions.

Answered: 1 week ago