Question
1)the primary code is in the pictures but I reached these 2 questions and didn't know how to solve them please can i have the
1)the primary code is in the pictures but I reached these 2 questions and didn't know how to solve them please can i have the written code for them please question 7 and 8:
7) Define a class for an article in the shopping cart with name InCart. This class shall have following members:
- a private pointer attribute with name article to an object of class Article
- a private integer attribute with name amount how many of this article are placed in the shopping cart.
- a private attribute with name next of type pointer to InCart for building up a list.
- a public constructor with three parameters to initialise the three attributes of an object; the amount shall be 0 as default parameter, the pointer to the next article in a shopping cart a null pointer also as default parameter.
- a virtual public destructor outputting "~Incart()" and the amount as well as calling the destructor for the article (see examples at the bottom).
- a public method with name get_next without parameters returning a pointer to the next article in shopping cart as function value.
- a virtual public method with name print without parameters, outputting the amount, then sending message print to the article in the shopping cart, then in a new line outputting formatted as in the examples at the bottom the single gross price and the total gross price for the chosen amount of articles onto an output stream (see example at the bottom).
- 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)!
code so far :
#include { 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& 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