Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

C++ question Create a class with name Footprint with members: - private attribute named name of type C++ string to whom the carbon footprint is

C++ question

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

Microsoft Visual Basic 2017 For Windows Web And Database Applications

Authors: Corinne Hoisington

1st Edition

1337102113, 978-1337102117

More Books

Students also viewed these Databases questions

Question

Explain how you can become more self-aware.

Answered: 1 week ago