doc aze

494 mots 2 pages
package pkg3d;

public class Point3D { float x; float y; float z; Point3D(float x,float y,float z){ this.x=x; this.y=y; this.z=z; } }

package pkg3d;

public abstract class Forme { private Point3D centre; private float densiter;

Point3D getCentre(){return centre;} void setCentre(Point3D c){centre=c;}

float getDensiter(){return densiter;} void setDensiter(float d){densiter=d;}

Forme (Point3D centre,float densiter){ this.centre=centre; this.densiter=densiter;}

public void bouger(float dx,float dy,float dz){ centre.x=centre.x+dx; centre.y=centre.y+dy; centre.z=centre.z+dz;}

public abstract double calculerSurface(); public abstract double calculerVolume ();

public double calculerPoids (){return densiter*this.calculerVolume();}

public String toString(){ return("centre de gravité: ("+centre.x+" , "+centre.y+" , "+centre.z+")\ndensité: "+densiter);}

public static boolean comparer(Forme f1, Forme f2){ boolean egale=false; if((f1 instanceof Boule) &&(f2 instanceof Boule)) { if ((f1.centre==f2.centre) && (f1.densiter)==(f2.densiter) &&(((Boule)f1).rayon==((Boule)f2).rayon) ) egale=true;} else {if((f1 instanceof Brique) &&(f2 instanceof Brique)){ if((f1.centre==f2.centre) && (f1.densiter)==(f2.densiter)&&(((Brique)f1).getLargeur()==((Brique)f2).getLargeur()) &&(((Brique)f1).getLongueur()==((Brique)f2).getLongueur())&&(((Brique)f1).getHauteur()==((Brique)f2).getLargeur())) egale=false;}} return egale;
}
}

package pkg3d;

public class Brique extends Forme{ private double largeur,longueur , hauteur; Brique(Point3D centre,float densiter,double largeur,double longueur,double hauteur){ super(centre,densiter); this.largeur=largeur; this.longueur=longueur; this.hauteur=hauteur; } double

en relation

  • Doc bts
    422 mots | 2 pages
  • Doc aep
    537 mots | 3 pages
  • doc altaien
    1680 mots | 7 pages
  • Doc esthe
    332 mots | 2 pages
  • Asean doc
    1716 mots | 7 pages
  • etude de doc
    286 mots | 2 pages
  • Doc
    253 mots | 2 pages
  • Doc.doc
    591 mots | 3 pages
  • doc
    962 mots | 4 pages
  • doc bts
    1561 mots | 7 pages
  • Doc emalexia
    1162 mots | 5 pages
  • Doc ect
    351 mots | 2 pages
  • Doc
    2950 mots | 12 pages
  • Doc
    871 mots | 4 pages
  • Alizee doc
    1068 mots | 5 pages