Lab #5: Ch.4 Stock Manager

Preparation

Do the following before arriving at lab:

Objectives

After completing this lab, you should be able to:

Main Exercises

  1. Open the Product project in the materials for Chapter 4.
  2. Open the StockManager class and add your name as another author.
  3. Exercise 4.36
  4. Exercise 4.37   (As the instructions specify, your code needs to stop iterating if the product is found.)
  5. Exercise 4.38   (As the instructions indicate, your code here needs to use findProduct().)
  6. Exercise 4.39   (As the instructions imply, your code here needs to use findProduct().)
  7. Exercise 4.40   (As the instructions specify, instead of using '==' to check whether one String is equal to another one, you need to use '.equals()'.

Demonstrating StockManager

The project includes a class StockDemo to test the various methods in StockManager.

  1. Instantiate a StockDemo.
  2. Invoke the demo() method.
  3. Invoke sellProduct() with 132 as the argument.
  4. Invoke sellProduct() with 135 as the argument.
  5. Make additions to StockDemo to test the additional methods you wrote for Exercise 4.40.

Turn in

Turn in a printout of your final version of the source code StockManager.java, and a printout of your demonstration using StockDemo.