class WalkmanHire {

  /* The Museum Walkman Hire program      J M Bishop  Jan 1997
     simulates the hiring of Walkmen from a fixed pool for G1
     each. There are several helpers at different counters
     handling the hire and replacement of the Walkmen.

     The number of Walkmen in the original pool is 50
     and the number of helpers serving is 3,
     but these can be overridden by parameters at run time
     e.g. java WalkmanHire 100 8.
     The cash float starts at zero.

     Illustrates monitors, with synchronize, wait and notify.
     Shows a main program and two different kinds of threads
     running simultaneously.
  */

  public static void main (String [] args) {

    // Get the number of Walkmen in the pool
    // and open the museum for business.
    if (args.length >= 1)
      pool = Integer.parseInt(args[0]);
    else pool = 50;
    Museum m = new Museum (pool);
    // Get the number of helpers
    // and open the counters.
    if (args.length >= 2)
      helpers = Integer.parseInt(args[1]);
    else helpers = 3;
    for (int i=0; i<helpers; i++)
      new Counter (m,i).start();
  }
  static int pool;
  static int helpers;
}
