public class Point {
    private double x, y;

    public Point() {
        this(0., 0.); // delegation de constructeur
    }

    public Point(double x, double y) {
        this.x = x;
        this.y = y;
    }
    public void translate(double dx, double dy) {
        this.x += dx;
        this.y += dy;
    }

    public double norme() {
        return Math.sqrt(this.x * this.x + this.y * this.y);
    }

    public String toString() {
        return String.format("(%.2f, %.2f)", this.x, this.y);
    }

    public boolean egale(Point autre) {
        return this.x == autre.x && this.y == autre.y;
    }

    public boolean equals(Object o) {
        if (o instanceof Point) {
            Point p = (Point)o;  // conversion de Object en Point
            return this.egale(p);
        } else {
            return false;
        }
    }
    public double dist(Point p) {
        double dx = p.x - this.x;
        double dy = p.y - this.y;
        return Math.sqrt(dx * dx + dy * dy);
    }

    static public double distance(Point p1, Point p2) {
        return p1.dist(p2);
    }
}
