Question: HELP!! public class Warehouse { / * * * storage is managed as one big stack, where items are laid on top of each other
HELP!! public class Warehouse
storage is managed as one big stack, where items are laid on top of each other
private ArrayList storage new ArrayList;
public int getNumberOfItemsInStock
work on: return the number of items in storage
return ;
Modify to add item to the collection and make the tests pass.
@param item the item to store in the Warehouse
public void receiveItem item
work on: store item at at the front of the list
modify to remove an item from the collection and make the tests pass
@return the item that was retrieved from storage
@throws OutOfStockException if there are no items to ship
public Item ship throws OutOfStockException
work on: return the last item in the list
public class Producer extends Thread
private String name;
private Warehouse warehouse;
private int numberOfItemsToProduce;
public ProducerString givenName, Warehouse givenWarehouse, int givenNumberOfItemsToProduce
name givenName;
warehouse givenWarehouse;
numberOfItemsToProduce givenNumberOfItemsToProduce;
@Override
public void run
System.out.printlnname running in Thread: Thread.currentThreadgetName;
work on: produce numberOfItemsToProduce new items
System.out.printlnname ended.";
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
