package tp2; public class exo1Segment { int extr1 , extr2; public int getExtr1() { return extr1; } public void setExtr1(int extr1) { this.extr1 = extr1; } public int getExtr2() { return extr2; } public void setExtr2(int extr2) { this.extr2 = extr2; } public exo1Segment(int extr1, int extr2) { super(); this.extr1 = extr1; this.extr2 = extr2; } public exo1Segment() { this.extr1 = 0; this.extr2 = 0; } public int longueur(){ return (int) Math.sqrt(Math.abs(Math.pow(extr1, 2)+Math.pow(extr2, 2))); } public void ordone(){ int ech; if(extr1>extr2){ ech=extr1; extr1=extr2; extr2=ech;} } public boolean isIn(int x){ if(x>Math.min(extr1, extr2) && x<Math.max(extr1, extr2) ) return true; return false; } public String toString(){ return "segment ["+Math.min(extr1, extr2)+","+ Math.max(extr1, extr2)+"]"; } }...
Commentaires
Enregistrer un commentaire