This is the P2PU Archive. If you want the current site, go to www.p2pu.org!
Your elderly uncle owns and runs a pawn shop. However, he is finding it difficult to keep track of items and their prices in his old age. He has hired you to write a simple program for him that will help him run his store. He wants the computer to be able to track his inventory, and calculate final prices of different orders for him.
Currently, there are 8 items in the store. They are:
When a customer first interfaces with the program, it should list which items are in stock and wait for a command. Next, the customer will issue a command to add an item to his or her virtual shopping cart. At some point, the customer will issue a command to finish the transaction; at this point, a receipt should be shown with each item the customer is purchasing, its price, and a grand total.
Exactly how the interface and commands operate is up to you, though you'll definitely want to use something like the gets method introduced in LtP Chapter 4 to receive the input from the user.
After a customer completes a transaction, the items should be removed from inventory and the cycle should start over (i.e., a revised list of items is presented and the next customer can select which to purchase).
BONUS: Your uncle's store also runs various promotions which need to be taken into account:
The discounts can overlap.