import java.awt.Point;

public class OrderedPoint extends Point implements Comparable<OrderedPoint> {
   public OrderedPoint(int x, int y) {
	   super(x,y);
	}
	/**
	 * compares distance to origin of "this" with "other"
	 * @param other 
	 * @return 0 if same, < 0 if "this" is closer to origin, > 0 if "this" further
	 */
   @Override
	public int compareTo(OrderedPoint other) {
	   return (this.x*this.x+this.y*this.y)-(other.x*other.x+other.y*other.y);
	}
	@Override
	public String toString() {
	   return super.toString() + " distance: " + this.distance(0.0,0.0);
	}
}