Question
please just the code for this question in C++: Define a class for a shopping cart with name ShoppingCart . This class shall have following
- please just the code for this question in C++: Define a class for a shopping cart with name ShoppingCart. This class shall have following members:
- a private pointer attribute with name articles to the head of a list of articles in the shopping cart of class InCart
- three private real valued attributes with names minFressShipping for which purchase value free shipping is offered, sumNetPrice for the total net price sum of all articles in the shopping cart and sumGrossPrice for the total gross price sum.
- a public standard constructor initialising an empty shopping cart with both sum values 0 EUR and the purchase value for free shipping with1000 EUR
- a public destructor outputting "~ShoppingCart()" and afterwards deleting each article in the shopping cart starting with an output "delete article: " such that no memory leak will exist.
- a public method with name set_minFreeShipping with one parameter assigning its value to the same named attribute.
- a public method with name add_article with an amount and a pointer to an article as parameters, adding a new object InCart on heap to the shopping cart and actualising the two sum variables of the class appropriately.
- a virtual public method with name print without parameters writing a shopping onto the standard output stream cart formatted as given in the examples at the bottom. Especially the net price sum, the tax (difference gross minus net total sum) and the gross price sum shall be outputted at the end of the shopping cart. Take care to also regard the (may be) shipping cost output of 5.90 EUR (see example at the bottom)!
#include #include #include using namespace std; //ANSWER 1 class Article { private: string model; double netPrice; double taxRate; public: Article(string m, double n, double t=19) { model.assign(m); netPrice=n; taxRate=t; } virtual~Article() { cout
{ //set_model(m); //set_netPrice(n); original=o; } virtual ~Accessory() { cout
} }; //ANSWER 3 enum class OperatingSystem { unknown, android, iOS, macOS, linux, proprietary, unix, windows }; ostream& operatorprint(); coutget_grossPrice(); cout Dokument2 - Word O Suchen Entwurf Layout Referenzen Sendungen berprfen Ansicht Hilfe Bildformat 1. Define an abstract base class for an offered article with name Article. This class shall have following members: a private string attribute with name model storing the article model name. two private real valued attributes with names netprice for the net price and taxRate storing the tax value in percent of the article. a public constructor with three parameters to initialise the attributes of an object; the tax rate shall be a default parameter with 19 %. a virtual public destructor producing an output "-Article()" at its call and the article model name (see examples below). a public method with name set model assigning a string parameter to the model name attribute. a public method with name set netPrice assigning the double parameter to the net price attribute. a public method with name get model without parameters returning the model name as function value. a public method with name get netPrice without parameters returning the net price as function value. a public method with name get grossPrice without parameters returning the gross price (gross price = net price + tax) as function value. a pure virtual public method with name print without parameter or return value. 2. Define a class with name Accessory derived from abstract class Article. This class shal have following members: a private Boolean attribute with name original for an original accessory. a public constructor with three parameters for the article name, the net price and whether it is an original accessory with true as default parameter. The tax rate shall be automatically initialised by the default parameter of class constructor Article. a virtual public destructor producing an output "Accessory() at its call (see examples at the bottom). a virtual public method with name print without parameters writing the article name and " (original accessory)", if it is an original one (see examples at the bottom). Define a C++11 enumeration class with name OperatingSystem and enumeration values unknown, android, ios, macos, linux, proprietary, unix and windows. Define an overloaded output operator
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