Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ question Please, your answer should be about my question. You'll get a thumbs up if I find your answer helpful. Thank you! Create a

C++ question

Please, your answer should be about my question. You'll get a thumbs up if I find your answer helpful. 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

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

Seven Databases In Seven Weeks A Guide To Modern Databases And The NoSQL Movement

Authors: Luc Perkins, Eric Redmond, Jim Wilson

2nd Edition

1680502530, 978-1680502534

More Books

Students also viewed these Databases questions

Question

Summarize the reactive strategy of your organization.

Answered: 1 week ago

Question

Have roles been defined and assigned?

Answered: 1 week ago