Ok im new to
java like most with issues on this
thread, so all my code is kinda a work in progress anyway, however i have a specific issue that I need addressed.
Im doing an assignment that involves displaying info about the coordinates of a triangle. I have to take 3 coordinates and calc the perimeter/area and display them and such. Theres other parts i have not gotten to yet such as adding an accessor and mutator to each method for the points, area and circumference.
I am getting a single error message that is keeping me from compiling.
Triangle.java:56: ';' expected
}
^
Ill post the code below, but for reference, the error is directly after return triangle.
public class Triangle
{
public Triangle(double x1, double y1, double x2, double y2, double x3, double y3)
{
/** Define 2-dimensional coordinate points that form
a triangle in double precision floating-point numbers
for values such that
Setting (x1,y1) = (0,0), (x2,y2) = (1,0) and (x3,y3) = (1,1)
*/
double x1 = 0;
double y1 = 0;
double x2 = 1;
double y2 = 0;
double x3 = 1;
double y3 = 1;
}
public double dist12()
/** Distance formula calulation from verteces of the Triangle:
dist = (Math.sqrt(a2 - a1) * (a2 - a1) + (b2 - b1) * (b2 - b1))
where (a1,b1) and (a2, b2) are points that make up a side of a triangle
*/
{
dist12 = (Math.sqrt(x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1));
}
public double dist23()
{
dist23 = (Math.sqrt(x3 - x2) * (x3 - x2) + (y3 - y2) * (y3 - y2));
}
public double dist13()
{
dist13 = (Math.sqrt(x1 - x3) * (x1 - x3) + (y1 - y3) * (y1 - y3));
}
/** Circumference calculation by the formula(Circumference = permimeter)
Circumference = side1 + side2 + side3
*/
public double circumference( double dist12, double dist23, double dist13)
{
circumference = dist12 + dist23 + dist13;
}
// Area calculation by the formula of Heron's formula
public double area( double circumference, double dist12, double dist23, double dist13)
{
area = (Math.sqrt(((circumference * 0.5)) * ((circumference * 0.5) - dist12) * ((circumference * 0.5) - dist23) * ((circumference * 0.5) - dist13)));
}
public
String toString()
{
return Triangle
}
}