-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR...
double a=0;
double b=0;
double c=0;
%>
求三角形面积请输入三角形的3条边长:
a=Double.parseDouble(request.getParameter("a"));
b=Double.parseDouble(request.getParameter("b"));
c=Double.parseDouble(request.getParameter("c"));
if((a+b)<=c||(a+c)<=b||(b+c)<=a){
out.println("The three sides can't construct a triangle.");
return;}
double p=(a+b+c)/2;
double area=Math.sqrt(p*(p-a)*(p-b)*(p-c));
out.println("Area="+area+"");
%>
上面这个JSP文件运行时将a b c转换成浮点数类型的代码提示错误,a=Double.parseDouble(request.getParameter("a")); 是哪里有问题?
展开