[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));
}
}
oldSoftDev -3 Junior Poster in Training
oldSoftDev -3 Junior Poster in Training
h3xc0de 0 Junior Poster in Training
Rashakil Fol 978 Super Senior Demiposter Team Colleague
oldSoftDev -3 Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.