Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I have programming homework to write a code for an online shop, the questions in the homework tells me what to do step by step

I have programming homework to write a code for an online shop, the questions in the homework tells me what to do step by step but I reached to a question where they asked me :how can I write a code for a private pointer attribute in class X to an object of class Z. and I couldn't answer bellow is 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<<"~Article deleted"<

{ set_model(m); set_netPrice(n); original=o; } virtual ~Accessory() { cout<<"~Accessory"<

} }; //ANSWER 3 enum class OperatingSystem { unknown, android, iOS, macOS, linux, proprietary, unix, windows }; ostream& operator<<(ostream& out, const OperatingSystem& os) { string osS; switch(os) { case OperatingSystem::unknown: { osS="unknown OS"; break; } case OperatingSystem::android: { osS="Android OS"; break; } case OperatingSystem::iOS: { osS="iOS"; break; } case OperatingSystem::macOS: { osS="MacOS"; break; } case OperatingSystem::proprietary: { osS="proprietary OS"; break; } case OperatingSystem::unix: { osS="Unix OS"; break; } case OperatingSystem::linux: { osS="linux OS"; break; } case OperatingSystem::windows: { osS="MS Windows OS"; break; } } } //ANSWER 4 class Device : public Article { private: int main_memory; string os; public: Device(string m,double n,int mm,double t,string ops=unknown):Article(string m,double n, double t) { set_model(m); os.assign(ops); set_netPrice(n); main_memory=mm; } virtual ~Device() { cout<<"~device()"<

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

Principles Of Database Systems With Internet And Java Applications

Authors: Greg Riccardi

1st Edition

020161247X, 978-0201612479

More Books

Students also viewed these Databases questions