public class Chair {
    
    String occupiedBy;
    int durability = 5;
    String color;
    
    Chair() {
        color = "uncolored";
    }
    
    Chair(String color) {
        this.color = color;
    }
    
    boolean isOccupied() {
        return occupiedBy != null;
    }
    
    String getOccupiedBy() {
        return occupiedBy;
    }
    
    void setOccupiedBy(String person) {
        occupiedBy = person;
        --durability;
        if (isBroken() && isOccupied()) {
            setUnoccupied();
        }
    }
    
    void setUnoccupied() {
        setOccupiedBy(null);
    }
    
    boolean isBroken() {
        return durability <= 0;
    }
       
    void repair() {
        durability = 5;
    }
    
    String getColor() {
        return color;
    }
}