package sample;
import java.util.InputMismatchException;
import java.util.Scanner;
public class Controller {
public static void main(String[] args) {
Scanner in =new Scanner(System.in);
boolean f;
double p,s;
do {
try {
System.out.println(“输入数值”);
System.out.println(“输入a边的值”);
double a=in.nextDouble();
System.out.println(“输入b边的值”);
double b=in.nextDouble();
System.out.println(“输入c边的值”);
double c=in.nextDouble();
f=false;
if ((a+b)>c&&(a+c)>b&&(c+b)>a){
p=(a+b+c)/2;
s=Math.sqrt(p*(p-a)(p-b)(p-c));
System.out.println(s);
System.out.println(“是否继续,(继续(y)):”);
String x=in.next();
char change=x.charAt(0);
if (change==‘y’){
f=true;
}
else {
f=false;
}
}else{
System.out.println(“输入的a,b,c三边值不能组成三角形,请重新输入”);
f=true;
}
}catch (InputMismatchException e){
System.out.println(“数值输入错误,请重新输入”);
String d=in.nextLine();
f=true;
}
}while (f);
}
}