/** An instance is a worker in a certain organization */
public class Worker {
    private String lname; // last name of this worker ("" if unknown)
    private int ssn;   // soc sec number, in 0..999999999
    private Worker boss; // This worker's boss (null if none)
    
    /** NOTE: class invariant: collection of comments on fields that give
        their meanings together with constraints on them. */
    
    /** NOTE: To evaluate new Worker(...) do this:
      * (1) draw (create) a new object of class Worker.
      * (2) Execute the constructor call Worker(...).
      * (3) Yield as value of the exp the name of new object
      */
    
    /** NOTE: Purpose of a constructor: to initialize ALL fields of a newly
       created object so that the class invariant is true.
    
    /** NOTE: To get everything indented properly, select all lines
        (control-a or command-a) and hit the tab key.
        */
    
    /** NOTE: A getter function yields some value, usually from some field.
              A setter procedure sets some field to sme value. */
    
    /** Constructor: an instance with name n, ssn s, and boss b */
    public Worker(String n, int s, Worker b) {
        lname= n;
        ssn= s;
        boss= b;
    }
    
    /** = last name of this Worker */
    public String getLname() {
        return lname;
    }
    
    /** = last 4 digits of the social sec number */
    public int getSsn() {
        return ssn % 10000;
    }
    
    /** = the boss of this Worker */
    public Worker getBoss() {
        return boss;
    }
    
    /** Set this worker's soc sec number to n.
      * Precondition: n in 0..999,999,999.
      * */
    public void setLastName(String n) {
        lname= n;
    }
}
