package cs362practice;

/**
 * @author Gary T. Leavens
 */
public /*@ pure @*/ class Polar implements Complex {

    // DECLARE ANY FIELDS YOU MAY NEED BELOW 





    
    /** Initialize this polar coordinate number
     * with magnitude mag and angle ang, except that
     * when the magnitude is negative, this
     * is interpreted as magnitude -mag and angle ang+Math.PI.
     * @param mag the magnitude desired
     * @param ang the angle in radians, measured
     *            counterclockwise from the positive x axis
     */
    /*@   requires mag >= 0;
      @   ensures this.magnitude() == mag;
      @   ensures this.angle() == standardizeAngle(ang);
      @ also
      @   requires mag < 0;
      @   ensures this.magnitude() == - mag;
      @   ensures this.angle() == standardizeAngle(ang+Math.PI);
      @*/
    public Polar(double mag, double ang) {






    }

    /** Standardize the angle so it's between
     * -Math.PI and Math.PI (radians).
     */
    public static /*@ pure @*/ double standardizeAngle(double rad) {
        rad = rad % (2*Math.PI);
        if (rad > Math.PI) {
            return rad - 2*Math.PI;
        } else if (rad < -Math.PI) {
            return rad + 2*Math.PI;
        } else {
            return rad;
        }
    }

    /** @see cs362practice.Complex#realPart() */
    public double realPart() {


    }

    /** @see cs362practice.Complex#imaginaryPart() */
    public double imaginaryPart() {


    }

    /** @see cs362practice.Complex#magnitude() */
    public double magnitude() {


    }

    /** @see cs362practice.Complex#angle() */
    public double angle() {


    }

    /** @see cs362practice.Complex#add(Complex) */
    public Complex add(Complex b) {




    }

    /** @see cs362practice.Complex#sub(Complex) */
    public Complex sub(Complex b) {




    }

    /** @see cs362practice.Complex#mul(Complex) */
    public Complex mul(Complex b) {




    }

    /** @see cs362practice.Complex#div(Complex) */
    public Complex div(Complex b) {




    }
    
    /** @see cs362practice.Complex#equals(Object) */
    public boolean equals(Object o) {








    }
    
    /** @see java.lang.Object#hashCode() */
    public int hashCode() {


    }

    /** @see java.lang.Object#toString() */
    public String toString() {
        return "(" + magnitude() + ", " + angle() + ")";
    }
}
