Question: In c++ Program Specifications Develop an inventory management system for an electronics store. The inventory system should have the following functionalities: - BuildInventory: read a
In c++






Program Specifications Develop an inventory management system for an electronics store. The inventory system should have the following functionalities: - BuildInventory: read a text file containing electronics products information and dynamically store them in an array of pointers. - ShowInventory: display all inventory items. - UpdateInventory: ask for item id and quantity. If found display cost and update Product object info (reduce Product's quantity and potentially update restocking flag). - Terminate: save current inventory to a text file. This programming assignment illustrates the following concepts: - Text file reading and writing. - Arrays of pointers and dynamic memory allocations with new and delete. - Inheritance. - C++ type casting: static_cast. opportunity to use polymorphism in the next assignment. Class Design You need at least three classes. class InventoryItem (minimum implementation specified below) - This is the base class. - Protected member data: item id (integer) and restocking (bool). - Public static data: - const integer (item id): initialize to 9999. - const bool (restocking): initialize to false. - Constructors - Default constructor: initialize item id and restocking using the default static data with member initializer syntax. - Non-default constructor: take 2 parameters. - Destructor: output "Inventoryltem with restocking destroyed ...." - Public member functions. mulakr/accessor for reslocking, item id. - Display: to show Inventoryltem item id and restocking (true/false). item id must be displayed as a 4-digit integer with leading 0 s if , 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" sucl - Cost: take an integer as its only parameter representing the quantity (how many product to be sold) and return the total cost (price * quantity parameter). class InventorySystem: (minimum implementation specified below). This class maintains an Inventory which is an array of pointers to InventoryItem which "point" to Product objects (Product class is derived from the base class InventoryItem) as shown below: - Public static data - constant integer denoting array size (initialized to 512 ). - constant string as default value for store name ("My Store"). - constant int as default value for product count (0). - constant string for Input file name. - constant string for Output file name. - Private member data - Store name - Product list (array of pointers to InventoryItem object whose size is the static data of value 512). - Constructors - Non-default constructor: taking a string for store name. Do similar initialization as specified in default constructor. - Destructor: Finally our destructor has something to work for: de-allocate dynamic memory for individual Product objects in the array of pointers (up to product count elements). - Private member function: Product. Otherwise return nullptr. - Public member functions: of product list may display only InventoryItem information. Extra work is needed to properly display both InventoryItem (base) and Products (derived objects) information. 0 update restocking to true and display a message asking for restocking). - Terminate: iterate through the array of pointers to write Product objects information to a text file (its name is the static data) in the same format as the input file's. - mutators/accessors for store name and product count. Implementation Requirements only access Item's member functions, not Product's member functions even though the Item * pointers do point to Product objects. protected member data. - Your text file must contain at least 8 products (you may come up with your own product data). - Here is how your main program should be implemented: - Declare a pointer to InventorySystem object and properly initialize it to nullptr (last time that 1 will remind you about initializing variables at declarations in C++) - Dynamically allocate an InventorySystem object using the non-default constructor (making up the data as needed). - Invoke Buildinventory - Invoke Showinventory - Invoke UpdateInventory - Invoke Terminate - De-allocate InventorySystem object pointers. - Starting with this assignment you're on your way to implement non-trivial programs. One suggestion is to divide the implementation into several phases: and check it against your text file. That will help to tell if you've loaded the text file correctly into the array of pointers. I can help you with some code here: product_list [ 0 ]->Display (J; // first element product_list {3}> Display (); // middle element product_list [ 7 ]-> Display ( ); // last element assuming your text file has only 8 products if ( product_list [8j== nullptr ) \{ cout
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
