@Test public void whenCalculateDistanceBetweenTwoPointsResultTen() { Point a = new Point(0d,5d); Point b = new Point(10d,5d); assertThat(a.distanceTo(b), is(10d)); }
public double distanceTo(Point point) { return Math.sqrt(Math.pow(point.x - this.x,2) + Math.pow(point.y - this.y,2)); }
Point { public double distanceTo(Point point) { return Math.sqrt(Math.pow(point.x - this.x,2) + Math.pow(point.y - this.y,2)); } }
Point { public double distanceTo(Point point) { return Math.sqrt(Math.pow(point.x - this.x,2) + Math.pow(point.y - this.y,2)); } Point(double x, double y); }
Point { public double distanceTo(Point point) { return Math.sqrt(Math.pow(point.x - this.x,2) + Math.pow(point.y - this.y,2)); } Point(double x, double y); double distanceTo(Point point); }
Point { public double distanceTo(Point point) { return Math.sqrt(Math.pow(point.x - this.x,2) + Math.pow(point.y - this.y,2)); } Point(double x, double y); double distanceTo(Point point); public double x; public double y; }