<html><head><meta name="color-scheme" content="light dark"></head><body><pre style="word-wrap: break-word; white-space: pre-wrap;">/** Maintain info about a worker */
public class W {
    private String lastName; // worker's last name (not null)
    private int ssn; // worker's social security number
    private W boss; // worker's boss (null if none)

    /** Constructor: worker with last name n, SSN s, boss b (null if none).
     * Precondition:  n not null,  s in 0..999999999 with
     *                no leading zeros.*/
    public W(String n, int s, W b) {
        lastName= n;
        ssn= s;
        boss= b;
    }

    /** = worker's last name */
    public String getLname() {
        return lastName;
    }

    /** = last 4 SSN digits */
    public String getSsn() {
        String s= "0000" + ssn;
        return s.substring(s.length() - 4);
    }

    /** = worker's boss (null if none) */
    public W getBoss() {
        return boss;
    }

    /** Set boss to b.  */
    public void setBoss(W b) {
        boss= b;
    }

    /** application code for demonstration. */
    public static void main(String[] args) {
    	W mike = new W("George", 123456789, null);
    	W fred = new W("Schneider", 98765432, null);
    	mike.setBoss(fred);
    }
}
</pre></body></html>