<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%@ include file="circle.jsp" %>
<%@ include file="ladder.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<div>
<form action="main.jsp">
<input type="number" name="A" placeholder="请输入梯形的上底"><br>
<input type="number" name="B" placeholder="请输入梯形的下底"><br>
<input type="number" name="H" placeholder="请输入梯形的高"><br>
<input type="submit" value="计算">
</form>
</div>
<%
String A=request.getParameter("A");
String B=request.getParameter("B");
String H=request.getParameter("H");
if(A!=null&&B!=null&&H!=null){
double a=Double.parseDouble(A);
double b=Double.parseDouble(B);
double h=Double.parseDouble(H);
double ls=(a+b)*h/2;
out.print("梯形的面积为:"+ls);
request.setAttribute("a", a);
request.setAttribute("xd", b);
request.setAttribute("h", h);
request.setAttribute("ls", ls);
}
%>
</body>
</html>
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<title>Insert title here</title>
</head>
<body>
<div>
<form action="main.jsp">
<input type="number" name="R" placeholder="请输入圆的半径"><br>
<input type="submit" value="计算">
</form>
</div>
<%
String R=request.getParameter("R");
if(R!=null){
double r=Double.parseDouble(R);
double s=r*r*3.14;
out.print("圆的面积为"+s);
request.setAttribute("s", s);
}
%>
</body>
</html>