Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1. Classes: a. A class of Product to store the products information. This class will store data common to all types of products in your

1. Classes: a. A class of Product to store the products information. This class will store data common to all types of products in your store. b. There are 4 child/derived classes: Bakery Items, Hair Care, Cleaning and Meat The attributes for the Product class: (All the attributes should be private) o productCode o productName o productCompany o Quantity o typeOfProduct (Bakery Items, Skin Care, Cleaning and Meat) Methods: Constructors and Destructor All the requires getters and setters Display Function A function for checking product Type. The object of base class should not be allowed. 2. Derived Classes a. Bakery Items i. Attributes: 1. Expiry date (Date type Object) 2. Manufacture Date( Date type Object) 3. Static numberOfBakeryGoods b. Skin Care i. Attributes: 1. Expiry date (Date type Object) 2. Manufacture Date( Date type Object) 3. Static numberOfSkinCareProducts 4. productFor (is this skin care product for hands, feet or face) c. Cleaning i. Attribute: 1. cleaningArea (Is this cleaning product for floor, bathroom or clothes) 2. Static numberOfCleaningProducts d. Meat i. Attribute: 1. typeOfMeat (chicken, beef, mutton or Veal) 2. Static numberOfMeatProducts Derived class methods: o Parameterized constructor with default arguments and Copy Constructor(use base initializer list with both constructors) o Destructor(with no memory leakage) o Getters/Setters for all private attributes(with no memory leakage and no returning of original memory handler) o Assignment Operator(with no memory leakage) o cin>> and cout<< operators o fin>> and fout<< operators (Do it yourself) 3. Write a class called Store, which will be used to store the list of various products, using a single array of pointers of flexible size. Note: Each item in the array should be a Product pointer, which should point to the appropriate type of Product. Your list should only be big enough to store the products flexibly. Note that the Store class is NOT part of the inheritance hierarchy. This class is used to store and manage a LIST of individual products. So all these products are held by a list class named as Store. Store: Attributes: Array of pointers to hold all the products A counter to maintain number of Products added and indexing of the array Methods: Your Store, class needs to have these public functions available: Store() Default constructor: Sets up an empty list. addProducts(Product *) It will add a new product into the array. searchProducts(char*) Function to find all the available products by type e.g. Bakery Item will find and display all such products with type Bakery Item. ~ Store( ) Destructor: Needs to reset all the array pointers with nullptr. bool saveData(const char* fileName) const; This function should create a file and write the number of all the products available and all the data of the products into an output file (filename should be passed by the user in the function). For example if user passes Your Name Store. Your function should open file Your Name Store.txt and write all data required in it. If the output file cannot be opened, return false for failure. Otherwise, after writing into file, return true for success. Remember: You are not allowed to return the memory handler (no getter) of the array outside the class. Hint: Overload indexing/subscript [] operator (both const and non-const) for it. Main(): A Non-Member Function: Function that display whole information of all the products on the screen. Hint: Will require indexing/subscript[] operator. void ShowProducts(const Store&) ; You cannot call any getters in this above function, except getCount(). This function should print the number of total products available to the screen and the current list of products, one product per line. All the information needs to be printed in this printout including inherited information and its own information. 4. Write a main program (in a separate file) that creates a single Store object and then implements a menu interface to allow interaction with the object. Your main program should implement the following menu loop (any single letter options should work): * Wlelcome to Your Name Store, * P for Show products list (brief): The Show products list option should call the non-member function that prints the whole information of all available products to screen. C for Create a data file (output file): The Create a data file option should call the appropriate class function for printing the available products information to file, respectively. A for Add new product: B for Bakery Item S for SkinCare M for Meat L for Cleaning F for Find product by type The Find Product option should find all the products of the given type and display its

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

OCA Oracle Database SQL Exam Guide Exam 1Z0-071

Authors: Steve O'Hearn

1st Edition

1259585492, 978-1259585494

More Books

Students also viewed these Databases questions

Question

6. Discuss the steps involved in conducting a task analysis.

Answered: 1 week ago