Introduction
Please begin by doing Lab #1, if you haven't aready. Next, modify the provided code as follows:
- Add a count to the GroceryItem
- Add an accessor, getCount()
- Modify toString() to include the count
- Modify the constructor to accept the count as a parameter
- Add an increaseCount(int additionalItems) method that increases the count by additionalItems
- Modify the GroceryItemTester to demonstrate that everything works (suggestion: do this as you go.)
- Add a totalPrice to the GroceryItem
- Add an accessor, getTotalPrice(), it should compute the price on the fly
- Modify toString() to include the totalPrice
- Modify the GroceryItemTester to demonstrate that everything works (suggestion: do this as you go.)
The Files
Compiling and Running
javac *.java java GroceryItemTester