import java.util.Scanner;
public class Test{
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
double a = in.nextDouble();
double b = in.nextDouble();
double c = in.nextDouble();
triAngle t = new triAngle(a,b,c);
System.out.println("["+a+","+b+","+c+"]"+"能构成三角形,面积:"+t.getArea());
}
}
class triAngle {
private double a;
private double b;
private double c;
triAngle(double a, double b, double c){
double max;
if(a > b && a > c) {
max = a;
}else if(b > c) {
max = b;
}else {
max = c;
}
if(a > 0 && b > 0 && c > 0 && a + b > c && a + c > b && b + c > a) {
this.a = a;
this.b = b;
this.c = c;
}else if(max > 0) {
this.a = max;
this.b = max;
this.c = max;
}else {
this.a = 0;
this.b = 0;
this.c = 0;
}
}
double getArea() {
//S=根号[s(s-a)(s-b)(s-c)]
double s = (a + b + c) / 2;
return Math.sqrt(s * (s - a) * (s - b) * (s - c));
}
}
朋友们,怎么给这个程序加上一个判定输入数据是否可以构成三角形的代码呀,搞不清楚呀