So this is a rather simple question I'm sure for java and been answered before, I just can't seem to exactly find this answer. Prefer if someone could just comment the answer.
If you have
class Triangle{
private double x1,x2,x3,y1,y2,y3;
public Triangle(Point point1, Point point2, Point point3)
{
x1=point1.getX();
y1=point1.getY();
x2=point2.getX();
y2=point2.getY();
x3=point3.getX();
y3=point3.getY();
//Trying to get x and y values of point1-point3
}
double width=x1-x2;
double length=y3-y2;
public double area()
{
return (length * width)/2;
}
So basically I have points defined to take two variables x and y and I'm trying to calculate this area of a triangle. So someone gives 3 points to make this triangle and I'm trying to get those values from the points and I do have getters for my points but I'm just ending up with nothing for length and width.
public int getId() { return id;}this.newid = id;?