SLO Baked Bakery wants a program to run a computer controlled cash register. Each sale may consist of one or more bakery items to be purchased. The program should prompt for and obtain the quantity purchased, product category, and price of each item. A quantity of zero indicates the last item has been entered for this sale. The total amount of the purchase should be calculated and displayed. Then the program should prompt for and obtain the amount of money received from the customer (a float value). It should then compute and display the amount of change due. At the end of the day, the clerk enters a quantity of negative one, which causes a display of the total amount of sales in each of the three product categories.
Quantity, an integer.
Product Category (Bread, Cake, Pastry), a character B, C, or P.
Price, a float, unit price of the item.
Payment, a float, amount of money received from the customer.
Total amount of the purchase, a float.
Change returned to the customer, a float.
At end of day, the total amount of sales for each product category, a float.
Initialize all totals to zero.
Read Quantity, Product Category, and Price for each item.
Determine purchase amount by totalling Quantity times price for each item.
(Assume no tax is involved).
Compute Change as Payment - Purchase
Add purchase amount to total sales for that product category
Display totals for each product category
In the future the program may have to be enhanced to accommodate more product categories, so you must design the program to store total sales in an array.
USER INTERFACE REQUIREMENT
The sample session below shows a simple console-style output. Optionally, you may use a WIMP interface (Windows, Icons, Menus, Pointers) which allows the user to select product category from a drop down menu and enter quantity and price into text input boxes.
Bakery Cash Register Program
Product Category (B,C,P)? B
Purchase Price is: $3.00
Change due customer is: $2.00
Product Category (B,C,P)? P
Product Category (B,C,P)? C
Purchase Price is: $9.25
Change due customer is: $0.75
End of Day Summary
Bread : $3.00
Cake : $5.50