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 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

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_2

Step: 3

blur-text-image_3

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

Refactoring Databases Evolutionary Database Design

Authors: Scott Ambler, Pramod Sadalage

1st Edition

0321774515, 978-0321774514

More Books

Students also viewed these Databases questions

Question

Summarize the economic impact of safety.

Answered: 1 week ago

Question

3. SCC Soft Computer

Answered: 1 week ago

Question

2. KMPG LLP

Answered: 1 week ago

Question

5. Wyeth Pharmaceuticals

Answered: 1 week ago