// Programs from class are posted on the lecture summaries webpage.

/** An instance is a worker in a certain organization */
public class Worker {
    
    private String name; // Last name (null if unknown/none, o.w. at least one character)
    private int ssn; // Social security #: in 0..999999999
    private Worker boss;  // Immediate boss (null if none)
    
    /** Constructor: a worker with 
      * last name n (null if unknown/none), 
      * SSN s, 
      * and boss b (null if none).
      * Precondition: if n is not null, it has at least one character.
      * Precondition: s in 0..999999999 with no leading zeros,
      * so SSN 012-34-5678 should be given as 12345678.*/
    public Worker(String n, int s, Worker b) {
        name= n;
        ssn= s;
        boss= b;
    }
    
    /** = worker's last name */
    public String getName() {
        return name;
    }
    
    /** Set worker's last name to n.
      * Precondition: if n is not null, it has at least one character.*/
    public void setName(String n) {
        name= n;
    }
    
    /** = last 4 SSN digits as an int without leading zeros */
    public int getSSN4() {
        return ssn % 10000;
    }
    
    /** = worker's boss (null if none) */
    public Worker getBoss() {
        return boss; 
    }
    
    /** Set boss to b */
    public void setBoss(Worker b) {
     boss=b;   
    }
    
}