In this program, you will implement a simple inheritance relation between office items. We have the parent class “Item” and three child classes: “Pen”, “Folder”, and “Paper”. You will implement these 4 classes. Details of each class is given below: Class: Item Int ID Int Type Int Price String Name Item(…) virtual void print() float discount Price(float rate) Class: Pen String inkColor float pointSize Class: Folder String color bool expanding Class


In this program, you will implement a simple inheritance relation between office items. We have the parent class “Item” and three child classes: “Pen”, “Folder”, and “Paper”. You will implement these 4 classes. Details of each class is given below: Class: Item Int ID Int Type Int Price String Name Item(…) virtual void print() float discount Price(float rate) Class: Pen String inkColor float pointSize Class: Folder String color bool expanding Class: Paper String size int quantity Pen…) void print() Folder(…) void print() Paper(…) void print() Item is the base class and it contains all common attributes and functions for all items. Each child class has two extra attributes and one print() function to print that item. Please note that print() function in the Item class is a virtual function. Your responsibility is to create these four classes. To make your work easier, this time I do not expect you to separate each class into a different file. You will fill the “item.h” file that is provided with homework | description. And this time, I am not expecting an “item.cpp” file. You will write everything in the header file. The main program (main.cpp) will also be provided to you. In the main program, all items are loaded into an item array by reading the file, and each item is printed with its discounted price. You do not need to make any changes on the main.cpp file. Each class has a constructor function and a print function. Print functions should print all features of the item. Please see the next figure for a reference. The discountPricel) function in the item class will calculate a discounted price of that item using the “rate” input. For example if the rate is 0.15, then the function will calculate price*(1-rate) and return result from the function.

 

Private and Confidential

Yours all information is private and confidential; it is not shared with any other party. So, no one will know that you have taken help for your Academic paper from us.



This essay is written by:

Prof. SirMojo Verified writer

Finished papers: 435

Proficient in:

English, History, Business and Entrepreneurship, Nursing, Psychology, Management

You can get writing help to write an essay on these topics
100% plagiarism-free

Hire This Writer
© 2017 theacademicessays. All Rights Reserved. Design & Developed by theacademicessays.

Ask Your Homework Today!

We have over 1000 academic writers ready and waiting to help you achieve academic success

Need Help? Chat with us
Loading...