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.
INPUTS
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.
OUTPUTS
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.
FUNCTIONAL REQUIREMENTS
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).
Read Payment
Compute Change as Payment - Purchase
Add purchase amount to total sales for that product category
Display totals for each product category
DESIGN REQUIREMENT
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.
SAMPLE SESSION
Bakery Cash Register Program
Quantity? 2
Product Category (B,C,P)? B
Price? 1.50
Quantity? 0
Purchase Price is: $3.00
Payment? 5.00
Change due customer is: $2.00
Quantity? 3
Product Category (B,C,P)? P
Price? 1.25
Quantity? 1
Product Category (B,C,P)? C
Price? 5.50
Quantity? 0
Purchase Price is: $9.25
Payment? 10.00
Change due customer is: $0.75
Quantity? -1
End of Day Summary
Bread : $3.00
Cake : $5.50
Pastry: $3.75