UNB/ CS/ David Bremner/ teaching/ java/ WorkStation.java
public class WorkStation {
     private int pcID;
  static  private int lastSerialNumber = 0;
    private int pcSerialNumber;
  public String make;
  int speed;
  static int NIP = 0; // NIP = Number of IBM PCs

  public WorkStation(String make, int speed) {
    this.make = make;
    this.speed = speed;

    pcID = getRand();
    lastSerialNumber++;
    pcSerialNumber=lastSerialNumber;

    if (make.equals("IBM")) 
      NIP++;
  }

  public String getMake() {
    return make;
  }

  public int getSpeed() {
    return speed;
  }

  public void setSpeed(int s) {
    speed = s;
  }

  public int getID() {
    return pcID;
  }

  public int getSerialNumber() {
    return pcSerialNumber;
  }

  public static int countIBM() {
    return NIP;
  }
  public static int getRand() {
    double r = 10000.0 * Math.random();
    return (int) r;
  }

  public Object clone() {
    // make a workstation with identical information
    WorkStation cloneWorkStation = new WorkStation(make, speed);
    return cloneWorkStation;
  }

  public String toString() {
    return "WorkStation[pcID = \"" + getID() + "\", Make = " + 
      getMake() + ", Speed = " + getSpeed() + ", Serial Number = " + getSerialNumber() + "]";
  }
}