// ordinary class inheriting from specification of generic class class Coordinate extends MyPair { // constructor public Coordinate() { super(0, 0, ""); } // constructor public Coordinate(int v1, int v2) { super(v1, v2); } // return distance between points public double distance(Coordinate other) { return Math.sqrt( (getFirst() - other.getFirst()) * (getFirst() - other.getFirst()) + (getSecond() - other.getSecond()) * (getSecond() - other.getSecond())); } // string is the pair in parens public String toString() { return "("+getFirst()+", "+getSecond()+")"; } }