/* Manipulations sur une classe quadrilatere  */

public class ManipulationQuadrilatereEnConsole {

/* Type agrege de stockage des informations   */
/* relatives a une position en 3 dimensions   */

  static class Position3D {
    double x = 0.0;
    double y = 0.0;
    double z = 0.0; };

/* Type agrege de stockage des informations   */
/* relatives a un quadrilatere en 3D          */

  static class Quadrilatere3D {
    Position3D p1 = new Position3D();
    Position3D p2 = new Position3D();
    Position3D p3 = new Position3D();
    Position3D p4 = new Position3D(); };

/* Programme principal                        */

  public static void main(String [] args) {
    Console.setTitle("ManipulationQuadrilatere");
    double perimetre = 0.0;
    Quadrilatere3D q = new Quadrilatere3D();
    Console.afficherln("SVP, les coordonnees de votre quadrilatere");
    Console.afficherln("Sommet 1");
    q.p1.x = Console.saisirDouble();
    q.p1.y = Console.saisirDouble();
    q.p1.z = Console.saisirDouble();
    Console.afficherln("Sommet 2");
    q.p2.x = Console.saisirDouble();
    q.p2.y = Console.saisirDouble();
    q.p2.z = Console.saisirDouble();
    Console.afficherln("Sommet 3");
    q.p3.x = Console.saisirDouble();
    q.p3.y = Console.saisirDouble();
    q.p3.z = Console.saisirDouble();
    Console.afficherln("Sommet 4");
    q.p4.x = Console.saisirDouble();
    q.p4.y = Console.saisirDouble();
    q.p4.z = Console.saisirDouble();
    perimetre = perimetre + Math.sqrt(Math.pow(q.p1.x-q.p2.x,2.0)+
                                      Math.pow(q.p1.y-q.p2.y,2.0)+
                                      Math.pow(q.p1.z-q.p2.z,2.0));
    perimetre = perimetre + Math.sqrt(Math.pow(q.p2.x-q.p3.x,2.0)+
                                      Math.pow(q.p2.y-q.p3.y,2.0)+
                                      Math.pow(q.p2.z-q.p3.z,2.0));
    perimetre = perimetre + Math.sqrt(Math.pow(q.p3.x-q.p4.x,2.0)+
                                      Math.pow(q.p3.y-q.p4.y,2.0)+
                                      Math.pow(q.p3.z-q.p4.z,2.0));
    perimetre = perimetre + Math.sqrt(Math.pow(q.p4.x-q.p1.x,2.0)+
                                      Math.pow(q.p4.y-q.p1.y,2.0)+
                                      Math.pow(q.p4.z-q.p1.z,2.0));
    Console.afficherln("Perimetre : ",perimetre);
  }
}