Question: Use C + + programming with using using namepace std In this programming exercise, you will simulate a grocery checkout counter by designing a
Use C programming with using "using namepace std
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, have
the following files:
CashRegister.h contains the CashRegister class declaration
CashRegister.cpp contains the CashRegister class implementation
StoreInventory.h contains the StoreInventory class declaration
StoreInventory.cpp contains the StoreInventory class implementation
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:
Ask the user for the name of the item and quantity being purchased. Do not accept a
negative value for the quantity.
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.
Get the items cost from the StoreInventory.
Add a profit to the cost to get the items unit price.
Multiply the unit price times the quantity being purchased to get the purchase subtotal
for that item.
Compute a sales tax on the subtotal of that item. For the purposes of this
exercise, we are assuming that every item will be charged a sales tax.
Add this to the purchase total for that customer.
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 scannedon Windows if you are using
Visual Studio, use systemcls 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 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 ie unit price The constructor will initialize
this list from an input file GroceryInventory.dat. The StoreInventory will have three
member functions in addition to the constructor:
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.
Given the name of an item, return its cost.
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
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 CurrentInventory.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
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
