色婷婷狠狠18禁久久YY,CHINESE性内射高清国产,国产女人18毛片水真多1,国产AV在线观看

java程序如何判斷是一個等腰三角形

呂致盈2年前21瀏覽0評論

java程序如何判斷是一個等腰三角形?

package demo;

import java.util.Scanner;

public class Triangle

{

/**

* 等腰

*/

public static final int ISOSCELES = 1;

/**

* 等邊

*/

public static final int EQUILATERAL = 2;

/**

* 直角

*/

public static final int RIGHTANGLE = 4;

/**

* 普通

*/

public static final int GENERAL = 6;

/**

* 不構成三角形

*/

public static final int NOTHING = 7;

double a;

double b;

double c;

public Triangle ( double a, double b, double c )

{

this.a = a;

this.b = b;

this.c = c;

}

public static int isWhichOne ( Triangle triangle )

{

double a = triangle.a;

double b = triangle.b;

double c = triangle.c;

if (a + b > c && a + c > b && b + c > a && Math.abs (a - b) < c && Math.abs (a - c) < b && Math.abs (b - c) < a)

{

if (a == b && a == c)

{

return Triangle.EQUILATERAL | Triangle.ISOSCELES;

}

else if (a * a + b * b == c * c || a * a + c * c == b * b || c * c + b * b == a * a)

{

if (a == b || a == c || b == c)

{

return Triangle.RIGHTANGLE | Triangle.ISOSCELES;

}

return Triangle.RIGHTANGLE;

}

else if (a == b || a == c || b == c)

{

return Triangle.ISOSCELES;

}

else

{

return Triangle.GENERAL;

}

}

else

{

return Triangle.NOTHING;

}

}

public static double perimeter ( Triangle triangle )

{

return triangle.a + triangle.b + triangle.c;

}

public static double area ( Triangle triangle )

{

double a = triangle.a;

double b = triangle.b;

double c = triangle.c;

return 1.d / 4 * Math.sqrt (( a + b + c ) * ( a + b - c ) * ( a + c - b ) * ( b + c - a ));

}d

java三角形,java程序如何判斷是一個等腰三角形