Part 2

Fair Allocation Strategy

At first things go well, but then he finds that he is constantly getting complaints from the novice players. In some circumstances, novice players might wait forever because they are continually overtaken by better players who require fewer balls. He decides on a policy of allocating strictly in arrival order.

Unable to load applet

To Do

2) Provide an implementation for class FairAllocator which enforces the above strategy:

class FairAllocator implements Allocator{
    public FairAllocator(int n) {...}
    synchronized public void get(int n) {...}
    synchronized public void put(int n) {...}
 }

Part 3