第五周上机作业

任务一、教材P39实验3

<%@ 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 bgcolor=cyan>
    <br>英文课文(English Text):
    </br>
    <p style="font-family: 宋体; font-size: 18; color: black">
        <jsp:include page="english/english.txt" />
        <br>课文音频(English Audio)</br>
        <jsp:include page="audio.jsp" />
    </p>
</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 bgcolor=pink>
    <embed src="english/english.mp3" autostart=false> 课文音频
    </embed>
</body>
</html>

 

 

任务二、教材P45  8题

提示:圆形面积需要一个param  梯形面积需要3个param,可以参考教材例2-11

<%@ 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 bgcolor=cyan>

    <p style="font-family: 宋体; font-size: 36">
        <jsp:include page="circle.jsp">
            <jsp:param name="r" value=" 3" />
        </jsp:include>
    <p style="font-family: 宋体; font-size: 36">
        <jsp:include page="ladder.jsp">
            <jsp:param name="shang" value="2" />
            <jsp:param name="xia" value=" 4" />
            <jsp:param name="gao" value="2" />
        </jsp:include>
</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>
    我是被加载的求圆形面积页面
    <%
    String r = request.getParameter("r");
    double r1 = Double.parseDouble(r);
    double area = 3.14 * r1 * r1;
    out.print(area);
%>
</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>
    我是被加载求梯形面积的页面
    <%
    String shang = request.getParameter("shang");
    String xia = request.getParameter("xia");
    String gao = request.getParameter("gao");
    double shang1 = Double.parseDouble(shang);
    double xia1 = Double.parseDouble(xia);
    double gao1 = Double.parseDouble(gao);
    double area = (shang1 + xia1) * gao1 / 2;
    out.print(area);
%>
</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>
    <table width="500px" height="500px" border="1" bordercolor="blue"
        align="center">
        <tr>
            <td colspan="2"><%@ include file="top.jsp"%></td>
        </tr>
        <tr>
            <td><%@ include file="left.jsp"%></td>
            <td><%@ include file="right.jsp"%></td>
        </tr>
        <tr>
            <td colspan="2"><%@ include file="end.jsp"%></td>
        </tr>
    </table>
</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">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title> 这是top
</head>
<%@ 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">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title> 这是left
</head>
<%@ 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">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title> 这是right
</head>
<%@ 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">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>Insert title here</title> 这是end
</head>

 

 

任务四、

 

 

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
</head>
<body>
    <%
    int a = (int) (Math.random() * 10 + 1);
  if(a%2==0){
     %>
    <jsp:forward page="two.jsp">
    <jsp:param value="<%=a %>" name="a"/>
    </jsp:forward>
    <%}
    else{ %>
      <jsp:forward page="one.jsp">
    <jsp:param value="<%=a %>" name="a"/>
    </jsp:forward>
    <%} %>
</body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
  <body>
    <%
     String a=request.getParameter("a");
    int a2=Integer.parseInt(a);
    out.print("我是生成的随机数:"+a2+",  hello,我是偶数");
    %>
  </body>
</html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>



  </head>
  
  <body>
    <%
    String a=request.getParameter("a");
    int a1=Integer.parseInt(a);
    out.print("我是生成的随机数:"+a1+",  hello,我是奇数");
     %>
  </body>
</html>

 

 

 

posted @ 2022-04-02 13:26  叼个奶嘴闯天下  阅读(24)  评论(0编辑  收藏  举报