Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public class Segment {
- //attributs
- Point origine;
- Point extremite;
- //constructeur
- Segment (Point p1, Point p2) {
- origine = p1;
- extremite = p2;
- }
- // Autres méthodes
- double longueur () {
- double l;
- l = Point.distance(origine, extremite);
- return l;
- }
- Point milieu () {
- Point milieu;
- milieu = new Point (0,0);
- milieu.abscisse = (origine.abscisse + extremite.abscisse) / 2;
- milieu.ordonnee = (origine.ordonnee + extremite.ordonnee) / 2;
- return milieu;
- }
- public static Segment creerS() {
- Segment s;
- Point p1, p2;
- p2 = Point.creerPt();
- p1 = Point.creerPt();
- s= new Segment (p1,p2);
- return s;
- }
- }
Add Comment
Please, Sign In to add comment