//(P)erhaps (C)lown (N)onsense (I)s (C)onstructive (O)nly (T)oward
//(G)etting (S)ettlers (U)nderwear
public class OrderedPair {
    //instance variables (ivars), properties, field variables
    private double x;
    private double y;
    private double absVal;
    private String label;
    
    //constructor(s)
    public OrderedPair(){
        System.out.println("...default constructor...");
        x = 0;
        y = 0;
        absVal = computeAbsVal();
        label = "O";
        
    }//default constructor
    
    public OrderedPair(double x, double y){
        System.out.println("...two parameter constructor...");
        this.x = x;
        this.y = y;
        absVal = computeAbsVal();
        label = "P";
    }//two-parameter constructor
    
    public OrderedPair(OrderedPair orig){
        System.out.println("...copy constructor...");
        x = orig.x;
        y = orig.y;
        absVal = computeAbsVal();
        label = orig.label + "_transpose";
    }//end copy constructor
    
    //override method, toString
    public String toString(){
        String temp = label + "(";
        temp += x + ", " + y + ")";
        return temp;
    }//end toString
    
    //getters (accessors)
    public double getAbsVal(){ return absVal;}
    public String getLabel(){return label;}
    
    //setters (mutators)
    public void setLabel(String lbl){
        System.out.println("...setLabel...");
        //dwr!
        label = lbl;
    }//end setLabel
    
    //utility method(s)
    public double computeAbsVal(){
        System.out.println("...computeAbsVal...");
        return Math.sqrt(Math.pow(x, 2) + Math.pow(y, 2));
        
    }//end computeAbsVal
    
    public void transpose(){
        System.out.println("...transpose...");
        //classic 'swap' code
        double temp = y;
        y = x;
        x = temp;
        //System.out.println("x, y = " + x + ", " + y);
    }//end transpose
    
    
}//end class