package workshop.tag4;

public class Gruppe8 {

    public static void main(String[] args) {
        Punkt punkt1 = new Punkt(2.0, 4.0);
        Punkt punkt2 = new Punkt(4, 1);

        System.out.print("Abstand zwischen Punkt1 (" + punkt1.x + ", " + punkt1.y + ") und " +
                "Punkt2 (" + punkt2.x + ", " + punkt2.y + "): ");
        System.out.println(punkt1.abstandZu(punkt2));
    }

}

class Punkt {
    public double x;
    public double y;

    public Punkt(double x, double y) {
        this.x = x;
        this.y = y;
    }

    public double abstandZu(Punkt p) {
        return Math.sqrt(Math.pow(x - p.x, 2) + Math.pow(y - p.y, 2));
    }
}