Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Design a CashRegister class that can be used with the InventoryItem class. The C

ID: 3654886 • Letter: D

Question

Design a CashRegister class that can be used with the InventoryItem class. The CashRegister class should perform the following. 1. Ask the user for the item and quantity being purchased. 2. Get the item's cost from the InventoryItem object. 3. Add a 30% profit to the cost to get the item's unit price. 4. Multiply the unit price times the quantity being purchased to get the purchase subtotal. 5. Compute a 6% sales tax on the subtotal to get the purchase total. 6. Display the purchase subtotal, tax, and the total on the screen. 7. Subtract the quantity being purchased from the onHand variable of the InventoryItem class object. Implement both classes in a complete program. Input Validation: Do not accept a negative value for the quantity of items being purchased.

Explanation / Answer

//This program demonstrates a class with a destructor #include #include #include "price.h" #include "Sale.h" #include "InventoryItem.h" using namespace std; int main() { int numSelected; double qtySelected; char again; double price; double cost; const int NUM_ITEMS = 5; InventoryItem inventory[] = { InventoryItem("Hammer", 6.95, 12), InventoryItem("Wrench", 8.75, 20), InventoryItem("Pliers", 3.75, 10), InventoryItem("Ratchet", 7.95, 14), InventoryItem("Screwdriver", 2.50, 22) }; do { cout