Question: 3. Examine the following structure and helper methods defined in a C program. Convert the entire program to C++ and replace the struct with a

 3. Examine the following structure and helper methods defined in aC program. Convert the entire program to C++ and replace the struct

3. Examine the following structure and helper methods defined in a C program. Convert the entire program to C++ and replace the struct with a class and replace the helper functions with member functions in the class. Make sure your class properly specifies const-correctness on its members (ref: core-guidelines): #include #include #include typedef struct const char sku; double price; size t quantity bool onSale; InventoryItem; void printItem(InventoryItem* item) printf("Item SKU: %s: $%.2f x %d (SALE: %s) ", item-sku, item->price, item->quantity, item->onSale?"true""false"); void sellItem(InventoryItem* item) item->quantity --1; void addInventory (InventoryItem item, size t stock) item->quantity+stock

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!