Question: #include #include using namespace std; const int MAX_SIZE = 50; const int TAX_RATE = 1.0825; struct Item { string name; int quantity; float cost; };
#include #include using namespace std; const int MAX_SIZE = 50; const int TAX_RATE = 1.0825; struct Item { string name; int quantity; float cost; }; class ManageInventory { private: int size{ MAX_SIZE }; int count; Item ** p_pInventoryItems; public: ManageInventory() : count{ 0 }, p_pInventoryItems{ new Item * [size] } {}; ManageInventory(int size) : size{ size }, count{ 0 }, p_pInventoryItems{ new Item * [size] } {}; ~ManageInventory(); void addItem(string name, int quantity, float cost); }; 1. Write the definition for addItem. Use the new operator to dynamically create instances of type Item. Store pointers to inventory items in the inventoryItemsarray.
2. Write the ManageInventory class destructor definition. Use the delete operator to dynamically destroy all Item objs stored in the inventoryItemsarray.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
