/**
* Finds the angles of A, B, and C when given the sides.
* Caleb Hess
* 4/27/07
*/
public class Triangle
{
/**
*@param a the length of a for the triangle
*@param b the length of b for the triangle
*@param c the length of c for the triangle
*/
public Triangle(double a, double b, double c)
{
this.a = a;
this.b = b;
this.c = c;
angleA = 0;
angleB = 0;
angleC = 0;
area = 0;
perimeter = 0;
}
public double calculateAngles()
{
final double RADIANS_TO_DEGREES = 180/Math.PI;
angleC = Math.acos((c * c - b * b - a * a)/(-2ab)) * RADIANS_TO_DEGREES;
angleB = Math.acos((b * b - a * a - c * c)/(-2ab)) * RADIANS_TO_DEGREES;
angleA = Math.acos((a * a - c * c - b * b)/(-2ab)) * RADIANS_TO_DEGREES;
}
public double calculateArea()
{
area = Math.sqrt((a + b + c)(a + b - c)(b + c - a)(c + a -b)) / 4;
}
public double calculatePerimeter()
{
perimeter = (a + b + c);
}
I get the error in my angleC = Math.acos line... anyone see what i did wrong?