Question
C++ question Please, your answer should be about my question. You'll get a thumbs up if you help. Thank you! Create a class with name
C++ question
Please, your answer should be about my question. You'll get a thumbs up if you help. Thank you!
Create a class with name Footprint with members:
- private attribute named name of type C++ string to whom the carbon footprint is assigned
- private pointer attribute named emissions in which to point to the head of a list of carbon dioxide emissions
- public constructor initialising the name to the value of the parameter and the pointer attribute to a C++ null pointer
- public destructor writing "destructor for carbon footprint for" , the name and "started..." onto the standard character output stream, then in a loop deletes all list items on the heap one by one and writes "destructor carbon footprint done" onto the standard character output stream at the end
- public member function named get_name without parameter returning the value of the same named attribute
- public member function named add with a pointer of type Emission (name of other class) as parameter inserting the pointed to object at the head of the list of the carbon emisssions.
- public member function named get_sum_co2 without parameter and with a floating point number as return. In the body the carbon emissions of all list elements shall be added and this sum value get returned
- public member function named print without parameter and without return. In the body, the name shall be outputted after the string "footprint for: " , the message print shall be sent to all objects in the list, then the sum of all carbon emissions shall be calculated and written onto the standard character output stream after "total carbon emissions: " in the units kg and tons
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