package inclass.Trianlge;
public class Triangle1
{
///DATA///
/// option a
private int Ax;
private int Ay;
private int Bx;
private int By;
private int Cx;
private int Cy;
/// option b
//
// private Point a;
// private Point b;
// private Point c;
//Constructor -- info from the outside world
public Triangle1(int ax, int ay, int bx, int by, int cx, int cy)
{
Ax = ax;
Ay = ay;
Bx = bx;
By = by;
Cx = cx;
Cy = cy;
}
public double lengthOfSides()
{
return (Math.sqrt(((Ax - Bx)*(Ax - Bx)) - ((Ay - By) * (Ay - By)))) +
(Math.sqrt(((Bx - Cx)*(Bx - Cx)) - ((By - Cy) * (By - Cy)))) +
(Math.sqrt(((Cx - Ax)*(Cx - Ax)) - ((Cy - Ay) * (Cy - Ay))));
}
}
output: The perimeter of the triangle is: NaN
*also btw when i just had the first two parts of the distance formula it was working