/* Calcul de la distance entre 2 positions du plan */

public class DistancePositions2DEnConsole {

/* Type agrege de stockage d'une position du plan  */

  static class Position2D {
    double abscisse;
    double ordonnee; };

/* Programme principal                             */

  public static void main(String [] args) {
    Console.setTitle("DistancePositions2D");
    Position2D p1 = new Position2D();
    Position2D p2 = new Position2D();
    double distance;
    double dx;
    double dy;
    Console.afficherln("SVP, coordonnees point 1?");
    p1.abscisse = Console.saisirDouble();
    p1.ordonnee = Console.saisirDouble();
    Console.afficherln("SVP, coordonnees point 2?");
    p2.abscisse = Console.saisirDouble();
    p2.ordonnee = Console.saisirDouble();
    dx = p2.abscisse-p1.abscisse;
    dy = p2.ordonnee-p1.ordonnee;
    distance = Math.sqrt(dx*dx+dy*dy);
    Console.afficherln("Distance = ",distance);
  }
}