CO2 emission calculator
- or -
Post a project like this1422
€30(approx. $32)
- Posted:
- Proposals: 3
- Remote
- #2841743
- Awarded
Description
Experience Level: Entry
I need to create a program that returns the amount of CO2-equivalent that will be caused when traveling a given distance using a given transportation method.
You are free to choose the programming language, libraries and tools for this task.
Functional requirements:
The tool can be called with a numeric distance , a unit-of-distance (kilometer km or meter m ) and a transportation method
$ ./co2-calculator --transportation-method medium-diesel-car --distance 15 --unit-of-distance km
--Your trip caused 2.6kg of CO2-equivalent.
--The default value for unit is kilometer km.
$ ./co2-calculator --distance 1800.5 --transportation-method large-petrol-car
Your trip caused 507.7kg of CO2-equivalent.
The output shows the amount of CO2-equivalent in kilogram kg or gram g .
$ ./co2-calculator --transportation-method train --distance 14500 --unit-of-distance m
Your trip caused 87g of CO2-equivalent.
$ ./co2-calculator --transportation-method train --distance 14500 --unit-of-distance m --output kg
Your trip caused 0.1kg of CO2-equivalent.
Named parameters can be put in any order and either use a space ( ) or equal sign ( = ) between key and value.
$ ./co2-calculator --unit-of-distance=km --distance 15 --transportation-method=medium-diesel-car
Your trip caused 2.6kg of CO2-equivalent.
For the calculation, please use the following average values.
Transportation methods in CO2e per passenger per km:
Small cars:
small-diesel-car : 142g
small-petrol-car : 154g
small-plugin-hybrid-car : 73g
small-electric-car : 50g
Medium cars:
medium-diesel-car : 171g
medium-petrol-car : 192g
medium-plugin-hybrid-car : 110g
medium-electric-car : 58g
Large cars:
large-diesel-car : 209g
large-petrol-car : 282g
large-plugin-hybrid-car : 126g
large-electric-car : 73g
bus : 27g
train : 6g
Non-Functional requirements:
The implemented features are unit tested
The implementation uses a dependency management tool which allows easy compilation and test execution (e.g. in an CI/CD
environment)
The README.md file contains clear instructions on how to compile, test and execute the tool
Best practices regarding architecture and code style are considered
Hints:
Consider using a library that handles parsing command line arguments (e.g. yargs if you use JavaScript)
Split printing the output from the logic to make testing easier
You are free to choose the programming language, libraries and tools for this task.
Functional requirements:
The tool can be called with a numeric distance , a unit-of-distance (kilometer km or meter m ) and a transportation method
$ ./co2-calculator --transportation-method medium-diesel-car --distance 15 --unit-of-distance km
--Your trip caused 2.6kg of CO2-equivalent.
--The default value for unit is kilometer km.
$ ./co2-calculator --distance 1800.5 --transportation-method large-petrol-car
Your trip caused 507.7kg of CO2-equivalent.
The output shows the amount of CO2-equivalent in kilogram kg or gram g .
$ ./co2-calculator --transportation-method train --distance 14500 --unit-of-distance m
Your trip caused 87g of CO2-equivalent.
$ ./co2-calculator --transportation-method train --distance 14500 --unit-of-distance m --output kg
Your trip caused 0.1kg of CO2-equivalent.
Named parameters can be put in any order and either use a space ( ) or equal sign ( = ) between key and value.
$ ./co2-calculator --unit-of-distance=km --distance 15 --transportation-method=medium-diesel-car
Your trip caused 2.6kg of CO2-equivalent.
For the calculation, please use the following average values.
Transportation methods in CO2e per passenger per km:
Small cars:
small-diesel-car : 142g
small-petrol-car : 154g
small-plugin-hybrid-car : 73g
small-electric-car : 50g
Medium cars:
medium-diesel-car : 171g
medium-petrol-car : 192g
medium-plugin-hybrid-car : 110g
medium-electric-car : 58g
Large cars:
large-diesel-car : 209g
large-petrol-car : 282g
large-plugin-hybrid-car : 126g
large-electric-car : 73g
bus : 27g
train : 6g
Non-Functional requirements:
The implemented features are unit tested
The implementation uses a dependency management tool which allows easy compilation and test execution (e.g. in an CI/CD
environment)
The README.md file contains clear instructions on how to compile, test and execute the tool
Best practices regarding architecture and code style are considered
Hints:
Consider using a library that handles parsing command line arguments (e.g. yargs if you use JavaScript)
Split printing the output from the logic to make testing easier
Swathi M.
100% (5)Projects Completed
5
Freelancers worked with
3
Projects awarded
56%
Last project
14 Jun 2020
Germany
New Proposal
Login to your account and send a proposal now to get this project.
Log inClarification Board Ask a Question
-
There are no clarification messages.
We collect cookies to enable the proper functioning and security of our website, and to enhance your experience. By clicking on 'Accept All Cookies', you consent to the use of these cookies. You can change your 'Cookies Settings' at any time. For more information, please read ourCookie Policy
Cookie Settings
Accept All Cookies