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.
Related Posts
Question 1 Janet Brown is 45 and divorced. She has two children who live with her and are dependent on her. Stephen is 12. Sarah is 17 and has been certified as eligible for the disability credit. Janet’s financial information for 2019 and 2020 includes the following: 2020 2019 Salary and taxable benefits $105,000 $100,000 Car expenses deducted in computing employment income
Uncategorized / By
Scenario: You are employed by Pacific IT Solutions as a solutions integrator. Your job description is to implement IT solutions and provide customer support. One of your long-time customers, Western Mining, has their head office in Sydney and is opening a branch office in Brisbane. You have been contracted to setup the network. A meeting has been held to start the project. The minutes of the meeting are as follows:
Uncategorized / By