package pravvich;

public class Point {
	public double x;
	public double y;

	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}
		
	public double distanceTo(Point that) {//принимает объект типа Point и называет that
		//calculate distance between two points
		double distance;
		return distance = Math.sqrt((Math.pow(that.y - this.y), 2) + (Math.pow(that.x - this.x), 2));
		}
}
package ru.pravvich;

public class Point {
	public double x;
	public double y;

	public Point(double x, double y) {
		this.x = x;
		this.y = y;
	}
		
	public double distanceTo(Point that) {
		double thatX, thatY, thisX, thisY;
		
		thisX = this.x;
		thisY = this.y;
		thatX = that.x;
		thatY = that.y;
		
		double distancePre;
		distancePre = Math.pow((thatY - thisY), 2) + Math.pow((thatX - thisX), 2);
		
		double distance;
		distance = Math.sqrt(distancePre);
		
		return distance;
		}
}
add chapter_001\lesson_3\src\main\java\ru\pravvich\Point.java