Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

please question 7 solution only: 7) Define a class for an article in the shopping cart with name InCart . This class shall have following

please question 7 solution only:

image text in transcribedimage text in transcribed

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

the code so far:

#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& operator 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

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

Databases DeMYSTiFieD

Authors: Andy Oppel

2nd Edition

0071747990, 978-0071747998

More Books

Students also viewed these Databases questions

Question

Express as the product of two elementary reduction matrices. 8 3

Answered: 1 week ago