CS127 Programming 2
In Class Exercise #3
Title: Cashier 1.2
Maximum Mark: 200 points
Cashier 1.0 is a C++ program that displays on the screen item codes with corresponding item description and price (at least 10 items). It asks the user to enter the code of the item purchased by a customer. It looks for a match of the item code stored in items.txt. Then, its description and price are displayed on the screen too. Also, it asks for the quantity of the particular item code entered. It displays its subtotal thereafter. Moreover, it keeps on accepting item codes until ‘0’ is pressed. Consequently, it displays the total amount due. Then, it asks the user to tender the amount of cash of the customer. Finally, it displays the change and its breakdown and sends the details of the transaction such as total amount due, amount tendered and change due to customer.txt.
• The program should inform the user is “items.txt” does not exist.
• The program should tell the user that the code is not found in “items.txt”.
• The program should not accept item codes that are not available.
• It should not accept quantity less than or equal to 0 and must keep on asking for a valid quantity.
• It should not accept amount of cash less than the amount due and must continue asking for a valid amount.
• It should ask the user if he/she wants another transaction.
• It should have input validations in all the user-program interaction.
• It should be able to handle exceptions.
Program Correctness 80%
Ease of Use 20%
Welcome to CS131xxx Mart!
Item Codes Description Price
100 Sweet ‘n Ripe Grapes 125.35
101 Crunchy Apples 52.20
… … …
109 Green Peas 25.75
Enter Code: 100
Sweet ‘n Ripe Grapes 125.35 Qty: 2
Enter Code: 101
Crunchy Apples 52.20 Qty: 1
Enter Code: 0