import java.util.*;
public class Triangle {
public static void main(String[] args) {
// TODO Auto-generated method stu
Scanner in=new Scanner(System.in);
System.out.println("The first length of a side:");
int a=in.nextInt();
System.out.println("The second length of a side:");
int b=in.nextInt();
System.out.println("The thirst length of a side:");
int c=in.nextInt();
Trian test=new Trian(a,b,c);
while(true){
test.judge();
System.out.println("Please input the index of side and length:");
int d=in.nextInt();
int e=in.nextInt();
test.change(d, e);
}
}
}
class Trian{
int a;
int b;
int c;
public Trian(int a,int b,int c){
this.a=a;
this.b=b;
this.c=c;
}
public void judge (){
if(a+b>c){
if(b+c>a){
if(a+c>b){
System.out.println("This can form a trigon!");
int p=(a+b+c)/2;
int t=p*(p-a)*(p-b)*(p-c);
double s=Math.sqrt(t);
System.out.println("This trigon area is "+s);
}
else{
System.out.println("This can't form a trigon!");
}
}
else{
System.out.println("This can't form a trigon!");
}
}
else{
System.out.println("This can't form a trigon!");
}
}
public void change(int d,int e){
switch(d){
case 1:
this.a=e;
break;
case 2:
this.b=e;
break;
case 3:
this.c=e;
break;
}
}
}