Lab 3: Cashiers in a Grocery
Download
this BlueJ project
that contains a PriceAndStockManager class
and an incomplete Cashier class.
- Complete the methods in the Cashier class.
- Create a Grocery class that tests the classes.
That class should contain a main method that creates
a PriceAndStockManager object and two Cashier objects
(associated with the manager object).
Invoke the buy methods from the cashier objects
and then check the stock levels of the
the different products.
- Arrange it so that PriceAndStockManager instead
aggregates and manages Product objects. In the
Product class, price and stock level should be stored;
there will then be three Product objects in PriceAndStockManager.
The Cashier and Grocery classes should still work after the
revision.
At this point you will have four classes in your project:
Grocery, Product, PriceAndStockManager, and Cashier.