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 -1;
}
/**
* Modify to add item to the collection and make the tests pass.
*
* @param item the item to store in the Warehouse
*/
public void receive(Item 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 Producer(String givenName, Warehouse givenWarehouse, int givenNumberOfItemsToProduce)
{
name = givenName;
warehouse = givenWarehouse;
numberOfItemsToProduce = givenNumberOfItemsToProduce;
}
@Override
public void run()
{
System.out.println(name +" running in Thread: "+ Thread.currentThread().getName());
//work on: produce numberOfItemsToProduce new items
System.out.println(name +" ended.");
}
}

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!