import java.util.Scanner;
public class labAssignment4 {
public static void main(String[] args){
Scanner user = new Scanner(System.in);
//Variables
double a, b, c;
System.out.println("Enter longest side: ");
a = user.nextDouble();
System.out.println("Enter second side: ");
b = user.nextDouble();
System.out.println("Enter third side: ");
c = user.nextDouble();
//Help fix code to compute triangle type correctly...
if (a==b&&b==c)
{
System.out.println("Equilateral Triangle");
}
else if (a==b && b==c);
{
System.out.println("Isoceles Triangle");
}
if (!((a == b) && (a == c) && (b == c)));
{
System.out.println("Scalene Triangle");
}
if (((a + b) >= (c)) ||((a + b) >= (b)) ||((b +c) >= (a)));
{
System.out.println("Not a Triangle");
}
}
}
帮助正确的公式来计算正确的三角形类型....任何帮助将不胜感激。我需要一些帮助来修改此代码,而且它似乎一直给我一个错误,返回多个结果。结果,我收到我的值等于等腰线、不等边线,而不是三角形值。