public class UforanderligtPunkt { private double x,y; public UforanderligtPunkt(double x1, double y1) { x = x1; y = y1; } public UforanderligtPunkt flytRelativ(double dx, double dy) { UforanderligtPunkt nytPkt = new UforanderligtPunkt(x+dx, y+dy); return nytPkt; } public double getX() { return x; } public double getY() { return y; } public double afstand(UforanderligtPunkt p) { return Math.sqrt( (x-p.x)*(x-p.x) + (y-p.y)*(y-p.y) ); } }