Coffee Tutorial Prep: Nino and Hosch Q4.2, 4.4


Q4.2 : Java specs for queries to determine a rectangle's length and width.

/**
 * return length of rectangle
 */
public double getLength()
    

/**
 * return width of rectangle
 */
public double getWidth()

Q4.4 : Java specs for class to model a 3--way lamp.

Class ThreeWayLamp
    
    /**
     * Class to model a 3way lamp.
     * Lamp may be off, on low, on medium, on high
     *
     */
public class ThreeWayLamp{
    
    /**
     * return true if lamp is on 
     *
     */
    public boolean isOn(){
    }

    /**
     * return true if lamp is on low
     *
     */
    public boolean isOnLow(){
    }
    
    /**
     * return true if lamp is on medium
     *
     */
    public boolean isOnMedium(){
    }

    /**
     * return true if lamp is on high
     *
     */
    public boolean isOnHigh(){
    }
    
    /**
     * command to change state of lamp
     * changes:  off to low
     *                   low to medium
     *                   med to high
     *                   high to off
     */
    public void changeState(){
    }
    
}