Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

JUST help me with Display and Cost in class Product: IN c++ class Product : derived from InventoryItem class (minimum implementation specified below). Private member

JUST help me with Display and Cost in class Product:

IN c++

class Product: derived from InventoryItem class (minimum implementation specified below).

  • Private member data: name (string), quantity (integer) and price (double).
  • Public static data:
    • const string (name): "No Product".
    • const int (quantity): 0
    • const double (price): 0.99
  • Constructors (use member initializer syntax)
    • Default constructor: set member data to static data's default values above. Must explicitly invoke the base class' default constructor.
    • Non-default constructor: take five parameters (id, restocking, name, quantity and price). Must explicitly invoke the base class' non-default constructor.
  • Destructor: output "Product: , Name, quantity, price , restocking destroyed ...".
  • Public member functions:
    • accessors/mutators for name, quantity, price.
    • Display: invoke Display from base class, then display its own data. NOTE: If the product restocking is true somehow indicate it using "special effects" such as ***** or whatever effect you'd like.
    • Cost: take an integer as its only parameter representing the quantity (how many products to be sold) and return the total cost (price * quantity parameter).

I just need some demo code. About the base class display, just to show me where and how to reference it.

Thank you

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

Professional Visual Basic 6 Databases

Authors: Charles Williams

1st Edition

1861002025, 978-1861002020

Students also viewed these Databases questions

Question

=+associated with political parties and if so, which ones? Are

Answered: 1 week ago