Question: SOLUTION MUST BE IN C++ In this programming exercise, you will simulate a grocery checkout counter by designing a CashRegister class that will interact with

SOLUTION MUST BE IN C++

In this programming exercise, you will simulate a grocery checkout counter by designing a CashRegister class that will interact with the StoreInventory class. You will also have to write the driver program to test your implementation. You must, at the very least, submit the following files for evaluation, possibly more based on your implementation: (1) CashRegister.h //contains the CashRegister class declaration (2) CashRegister.cpp //contains the CashRegister class implementation (3) StoreInventory.h //contains the StoreInventory class declaration (4) StoreInventory.cpp //contains the StoreInventory class implementation (5) GroceryCheckout.cpp //driver program to test your class implementations When a customer scans an item at the checkout counter, the CashRegister will perform the following through a member function: 1. Ask the user for the name of the item and quantity being purchased. Do not accept a negative value for the quantity. 2. Check with the StoreInventory if that particular item is available in the store and if sufficient quantity of that item is available for purchase. If the item is not available in the store or if there is not sufficient quantity in the inventory for that item, the CashRegister must diplay an appropriate message to the customer and that item must not be included in the purchase. 3. Get the items cost from the StoreInventory. 4. Add a 30% profit to the cost to get the items unit price. 5. Multiply the unit price times the quantity being purchased to get the purchase subtotal for that item. 6. Compute a 4% sales tax on the subtotal of that item. (For the purposes of this homework, we are assuming that every item will be charged a sales tax.) 7. Add this to the purchase total for that customer. 8. Instruct the StoreInventory to update the inventory entry for that item. In addition to the above member function, the CashRegister class will also have a default constructor, a display function and a reset function. The display function will display the updated total for a customer as each item is scanned (on Windows, use system(cls) to achieve this effect). The reset function will reset the purchase total before the next customer begins to check out. The StoreInventory class will store a list of no more than 50 items, where for each item the following information is available: name of the item, number of units of that item in the inventory, cost of one unit of the item (i.e., unit price). The constructor will initialize this list from an input file HW1-inventory.dat. The StoreInventory will have three member functions in addition to the constructor: 1. Given the name of an item and the number of units required, check if the inventory has that item and whether it has sufficient quantity of that item and return a boolean value accordingly. 2. Given the name of an item, return its cost. 3. Given the name of an item and the number of units, update the inventory accordingly. (Note: We want this member function to be distinct from that in (1).) You will write a driver program to test your implementations. Your program should allow for any number of customers to purchase any number of items. At the end of the day, that is when all customer transactions are done, you should write out the updated remaining inventory to the file HW1-inventory.out. The format of the output file will be similar to that of the input file.

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!