Question: C++ Help This machine problem covers inheritance. You are to define and implement a base class named Store that contains the following members: Data members:

C++ Help

This machine problem covers inheritance. You are to define and implement a base class named Store that contains the following members:

Data members: (protected)

- a string variable called itemName

- a integer variable called quantity

- a double variable called price

Member functions: (public)

- default constructor with default values ("book", 15, 20.5).

- overload constructor with arguments.

- Setters & Getters functions.

- display function.

- function called total_price() that returns quantity*price

Now created a derived class called product class that inherits class Store. it will contain the following addition members

Data members : (private)

- an integer variable called amount.

Member functions: (public)

- default constructor with default values ("book",15,20.5,30).

- overload constructor with arguments.

- Setters & Getters functions.

- display function.

- function called total_price() that returns (quantity*price)+(amount * price))

- function called total_amount() that returns quantity+amount

Define and implement main programs TestBox that does the following

define object str1 of Store with data (keyboard,30,12.4).

Print its Total_price and its contents.

define object prod1 form Product with default values

define object prod2 from Product with (mouse,60,12.6,14) values

print the total price and total amount of prod2

print content of prod1.

Print quantity of str1 and prod2.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!