0
[code=java]
public class LineSeg{

  // these are the attributes of a LineSeg object
  private Point end1;
  private Point end2;
  private double length;

    // the constructor
    public LineSeg(double x1, double y1, double x2, double y2) {

        end1 = new Point(x1,y1);
        end2 = new Point(x2,y2);
        this.length=(double)(Math.sqrt((x2-x1)**2+(y2-y1)**2));
     }  
 }
3
Contributors
4
Replies
5
Views
9 Years
Discussion Span
Last Post by sfar_furqan
0

You have to many * in this.length=(double)(Math.sqrt((x2-x1)**2+(y2-y1)**2));

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.