Grocery store
Start from ready-to-use Eclipse project GroceryProject.zip
(follow the instructions)
Implement a system to manage a grocery store with a single cash
counter. The
system must meet the following
requirements.
R1: Inventory
Class GroceryCounter contains
all functionalities. First, it is possible to define the inventory
(listing of product types)
by adding new products by means of method addProduct(). A product is
characterized by its unique code, a description, and the selling net
price. For instance:
Code
|
Description
|
Price
|
| P001 |
Coffee |
3.0 |
| P002 |
Tuna |
1.5 |
| P003 |
Olive oil |
2.0 |
R2: Discount
It is possible to set a promotional price (i.e., discounted) for a
particular product. For simplicity, suppose that there is only
one discounted product at a time. The promotion is set by means of
method promo(), which accepts
the code of the to-be-discounted product and the discount percentage
(e.g., integer 20 means 20% off). Current discount is disabled by using
the code on a non-existing product.
R3: Check out
During check out, the cashier inserts the product code and the number
of bought pieces for each item in the kart. This is done through method
read(), item by item.
At any time during check out, it is possible to obtain the current net
total through method total().
Furthermore, it is possible to obtain the gross total and the tax
amount with methods gross()
and taxes(), respectively.
Method print() prints on
screen the invoice (item by item). The listing must be ordered by item
descriptions (ascending).
Finally, method close() closes
current check out session (i.e., the counter is ready
for next check out).