第五周作业

1.教材P39实验3
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>      <body bgcolor=pink>  <embed src="english/english.mp3" autostart=false>  课文音频  </embed>  </body></html>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%String path = request.getContextPath();String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html>  <head>    <base href="<%=basePath%>">        <title>听英语</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>

 

 

2.教材P45  8题
<%--Created by IntelliJ IDEA.  User:97442Date:2022/3/21Time:16:13To changethistemplate use File | Settings |File Templates.--%><%@ page contentType="text/html;charset=UTF-8" language="java" %><html>

<head>    <title>$Title$</title></head><body><jsp:include page="audio.jsp">   

 <jsp:param value="5" name="r"/></jsp:include><jsp:include page="ss.jsp">   

 

 <jsp:param value="4" name="h"/>    <jsp:param value="6" name="sd"/>   

 <jsp:param value="3" name="xd"/></jsp:include></body></html>
<%--Created by IntelliJ IDEA.  User:97442Date:2022/3/30Time:11:18To changethistemplate use File | Settings |File Templates.--%><%@ page contentType="text/html;charset=UTF-8" language="java" %><html>

<head> 

   <title>Title</title></head><body><%doubler = request.getParameter("r") ==null? 0 : Double.parseDouble(request.getParameter("r"));doublearea = 3.14 * r *r;    out.print("圆的半径为:" + r + "</br>面积为:" +area);    out.print("</br>--------------------------------</br>");%></body></html>
<%--Created by IntelliJ IDEA.  User:97442Date:2022/4/3Time:14:50To changethistemplate use File | Settings |File Templates.--%><%@ page contentType="text/html;charset=UTF-8" language="java" %><html><head>   

 <title>Title</title></head><body><%doubleh = request.getParameter("h") ==null? 0: Double            .parseDouble(request.getParameter("h"));doublesd = request.getParameter("sd") ==null? 0: Double            .parseDouble(request.getParameter("sd"));doublexd = request.getParameter("xd") ==null? 0: Double            .parseDouble(request.getParameter("xd"));doublearea = ((sd + xd) * h) / 2;    out.print("梯形上底:" + sd + "</br>下底:" + xd + "</br>高:" + h + "</br>面积:" +area);%>

</body>

</html>

 

 3.

<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"><html> 

 <head>  </head> 

  <body> 

   <table border="1" width="500" align="center" bgcolor="yellow"> 

 <tr align="center"><td colspan="2">

<%@include file="top.jsp" %>

</td></tr>  <tr align="center"><td><%@include file="left.jsp" %></td><td align="center">  <%@include file="main.jsp" %></td></tr>    <tr align="center"><td colspan="2"><%@include file="end.jsp" %></td></tr>  </table>  </body></html>


<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%="top.jsp的文件内容包含在这里" %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%="left.jsp的文件内容包含在这里" %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%="main.jsp的文件内容包含在这里" %>
<%@ page language="java" import="java.util.*" pageEncoding="utf-8"%><%="end.jsp的文件内容包含在这里" %>

 

4.

<body>

<%Strings=request.getParameter("number");inta=Integer.parseInt(s);   out.println("随机数是"+a);%>

<h1>Hello,我是一个偶数!</h1>

</body>

<body>

<%Strings=request.getParameter("number");inta=Integer.parseInt(s);   out.println("随机数是"+a);%>

<h1>Hello,我是一个奇数!</h1>

</body>

<body>

<h1>产生一个0到10的随机整数</h1>

<%inti=(int)Math.round(Math.random()*10);if(i%2==0){%><jsp:forwardpage="even.jsp">

<jsp:paramvalue="<%=i %>"name="number"/>

</jsp:forward><%}else{%><jsp:forwardpage="oddNumber.jsp">

<jsp:paramvalue="<%=i %>"name="number"/></jsp:forward><%}%>

</body>

 

posted @ 2022-04-03 18:27  计算机1903庞斯文  阅读(28)  评论(0编辑  收藏  举报