
Untitled
By: a guest on
May 9th, 2012 | syntax:
None | size: 1.39 KB | hits: 21 | expires: Never
class triangleAssigment
{
public static void main (String[] args)
{
int a;
int b;
int c;
int a2;
int b2;
int c2;
do
{
System.out.println("Please enter three sides of a tringle or - 0 0 0 to terminate");
a = In.getInt();
b = In.getInt();
c = In.getInt();
a2 = a*a;
b2 = b*b;
c2 = c*c;
//declare methods
if(isFinished(a,b,c) == false)
{
determineType(a2,b2,c2);
classifySides(a,b,c);
displayValues(a,b,c);
}
else
{
System.out.println("Program terminated");
}
} while(!isFinished(a, b, c));
}
// determinbe is isFInished returs true or false
public static boolean isFinished( int a, int b, int c)
{
if(a == 0 && b == 0 && c == 0)
{
return true;
}
else
{
return false;
}
}
//determine type of triangle
public static string determineType(int a2, int b2, int c2)
{
String angleType;
if (a2 + b2 == c2)
{
angleType = "right";
}
else if(a2 + b2 > c2)
{
angleType = "acute";
}
else
{
angleType = "obtuse";
}
return angleType;
}
// classify your triangle by sides
public static int classifySides(int a, int b, int c)
{
if
}