软件工程个人作业2-四则运算2

简介: 四则运算 做题页 .aaa { text-align: center; font-weight: bold;} .

四则运算

<%@ page language="java" import="java.util.*,java.sql.*" 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>
    <style type="text/css">
    .aaa {
    text-align: center;
    font-weight: bold;
}
   .aa {
    text-align: center;
}
#tijiao {
    text-align: center;
}
  #form p label {
    text-align: center;
}
  #form1{
    text-align: center;
}
.qqq {
    text-align: center;
    font-size: 36px;
    font-family: "微软雅黑";
}
    </style>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

  </head>
  <body background="timg.jpg">
  <p>&nbsp;  </p>
  <p class="qqq">做题页</p>
  <p>&nbsp;</p>
  <p>
  <form id="form1" name="form1" method="post" action="MyJsp1.jsp">
  <table width="386" border="1" align="center">
  <tr>
    <td width="79" height="23" class="aaa">题号</td>
    <td width="116" class="aaa">题目</td>
    <td width="169" class="aaa">答案</td>
  </tr>

  
  <%
      int time1=(int)session.getAttribute("time");
      dao.DBUtil db=new dao.DBUtil();
      Connection conn =db.getConn();
        Statement stmt = conn.createStatement();//从数据库里面取东西对比    
        ResultSet rs=stmt.executeQuery("select * from yunsuan");
        int x=0;
        int y=1;
        while(rs.next())
        {
            x++;
            int num1=rs.getInt("num1");
            int num2=rs.getInt("num2");
            String symbol=rs.getString("symbol");
   %>
   <table width="386" border="1" align="center">
           <tr>
    <td width="79" height="23" class="aa"><%=y %>.</td>
    <td width="116" class="aa"><%=num1+symbol+num2 %>=</td>
    <td width="169" class="aa">
    <input type="text" name="<%=x %>" id="<%=x %>" />
    </td>
  </tr>
</table>
   <%
   y++;
           }
    %>
    </table>
    <p>&nbsp;</p>
    <input type="submit" name="tijiao" id="tijiao"  value="提交" />
    </form>
    <p>&nbsp; </p>
    <head>
      <script type="text/javascript">
        var time =<%=time1%>; //时间,秒
        function Redirect() {
         window.location = "MyJsp1.jsp";
        }
        var i = 0;
        function dis() {
         document.all.s.innerHTML = "还剩" + (time - i) + "秒";
         i++;
        }
        timer = setInterval('dis()', 1000); //显示时间
        timer = setTimeout('Redirect()', time * 1000); //跳转
      </script>
  </head>
<table width="507" border="1" align="center">
    <td width="229" class="a" style="text-align: center; color: #F00;"><span  id="s"></span></td>
</table>
  </body>
</html>
MyJsp
<%@ page language="java" import="java.util.*,java.sql.*" 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>
     <style type="text/css">

  #form1 p label {
    text-align: center;
}
  #form1 {
    text-align: center;
}
     </style>
    <style type="text/css">
.a {
    color: #0F0;
}
.qqq {
    text-align: center;
    font-size: 36px;
    font-family: "微软雅黑";
}
    </style>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->

  </head>
  
  <body background="timg.jpg">
  <p>&nbsp;  </p>
  <p class="qqq">结果页</p>
  <p>&nbsp;</p>
  <p>
    <% 
          dao.DBUtil db=new dao.DBUtil();
          Connection conn =db.getConn();
        Statement stmt = conn.createStatement();//从数据库里面取东西对比    
        ResultSet rs=stmt.executeQuery("select * from yunsuan");
        int x=0;
        double q=0;//对题数
              double p=0;//错题数
        while(rs.next())
        {
            x++;
            String y=String.valueOf(x);
            int num1=rs.getInt("num1");
            int num2=rs.getInt("num2");
            String symbol=rs.getString("symbol");
            int find=rs.getInt("find");
            int a=0;
            
            if(request.getParameter(y)!=null&&(!"".equals(request.getParameter(y))))
            {
                a=Integer.parseInt(request.getParameter(y));
            }
   %>
  </p>
         <table width="507" border="1" align="center">
              <tr>
    <td width="131" style="text-align: center"><%=num1+symbol+num2 %>=</td>
    <td width="125" style="text-align: center"><%=a %></td>
    
        <%
            if(find==a)
            {
                q++;
         %>
         <td width="229" class="a" style="text-align: center">回答正确</td>
         <%
             }
             else
             {
                 p++;
          %>
        <td width="229" class="a" style="text-align: center; color: #F00;">回答错误,正确答案为<%=find %></td>
    <%
    
    }
    }
     %>
  </tr>
        </table>
  <%
   stmt.executeUpdate("delete from  yunsuan");
      
   %>
   <br>
   <br>
   <br>
     <table width="700" border="1" align="center">
  <tr>
    <td width="200" height="23" class="aaa">总题数:<%=q+p%></td>
    <td width="300" class="aaa">做对<%=q %>题   正确率:<%=q/(q+p)*100 %>%</td>
    <td width="200" class="aaa">做错<%=p %>题</td>
  </tr>
  </table>
       <form id="form1" name="form1" method="post" action="index.jsp">
       <p>&nbsp;</p>
       <input type="submit" name="tijiao" id="tijiao" value="继续答题" />
    </form>
  </body>
</html>
MyJsp1
<%@ 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>
    <meta http-equiv="pragma" content="no-cache">
    <meta http-equiv="cache-control" content="no-cache">
    <meta http-equiv="expires" content="0">    
    <meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
    <meta http-equiv="description" content="This is my page">
    <!--
    <link rel="stylesheet" type="text/css" href="styles.css">
    -->
  <style type="text/css">
  #form2 p {
    text-align: center;
}
  #form1 p label {
    text-align: center;
}
  #form1 {
    text-align: center;
}
  </style>
  <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
  </head>
  
  <body background="timg.jpg">
  <form id="form2" name="form2" method="post" action="">
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
  <p>&nbsp;</p>
</form>
    <form id="form1" name="form1" method="post" action="servlet/YunServlet?method=add">
  <p>
    <span id="form1">
    <label for="name">要做的题数:</label>
    <input type="text" name="num" id="num" />
    </span></p>
  <p>
    <label for="name2">限制的时间:</label>
    <input type="text" name="time" id="time" />
  </p>
      
     <p>
       <input type="submit" name="tijiao" id="tijiao"  align="center" value="提交" />
     </p>
</form>
  </body>
</html>
index

 

 

 

目录
相关文章
|
安全 小程序 PHP
PHP代码审计(五)PHP代码审计方法与步骤
(1):获取到网站源码(这就是废话……) (2):将网站部署到你自己的环境中,能运行。 这里特殊说明一下我的习惯,我本地的环境与线上的环境基本上保持一致,这样在本地审计及线上部署的时候能发现更多的问题。不建议说是随便搭个环境能跑起来就行,这样不是很严谨。 (3):拿到源码之后,浏览大概的项目结构。
345 0
|
数据安全/隐私保护 C++
学习C++笔记287
C++ 继承
158 0
|
18天前
|
人工智能 数据可视化 安全
王炸组合!阿里云 OpenClaw X 飞书 CLI,开启 Agent 基建狂潮!(附带免费使用6个月服务器)
本文详解如何用阿里云Lighthouse一键部署OpenClaw,结合飞书CLI等工具,让AI真正“动手”——自动群发、生成科研日报、整理知识库。核心理念:未来软件应为AI而生,CLI即AI的“手脚”,实现高效、安全、可控的智能自动化。
34839 46
王炸组合!阿里云 OpenClaw X 飞书 CLI,开启 Agent 基建狂潮!(附带免费使用6个月服务器)
|
12天前
|
人工智能 自然语言处理 安全
Claude Code 全攻略:命令大全 + 实战工作流(建议收藏)
本文介绍了Claude Code终端AI助手的使用指南,主要内容包括:1)常用命令如版本查看、项目启动和更新;2)三种工作模式切换及界面说明;3)核心功能指令速查表,包含初始化、压缩对话、清除历史等操作;4)详细解析了/init、/help、/clear、/compact、/memory等关键命令的使用场景和语法。文章通过丰富的界面截图和场景示例,帮助开发者快速掌握如何通过命令行和交互界面高效使用Claude Code进行项目开发,特别强调了CLAUDE.md文件作为项目知识库的核心作用。
11802 37
Claude Code 全攻略:命令大全 + 实战工作流(建议收藏)
|
8天前
|
人工智能 JavaScript Ubuntu
低成本搭建AIP自动化写作系统:Hermes保姆级使用教程,长文和逐步实操贴图
我带着怀疑的态度,深度使用了几天,聚焦微信公众号AIP自动化写作场景,写出来的几篇文章,几乎没有什么修改,至少合乎我本人的意愿,而且排版风格,也越来越完善,同样是起码过得了我自己这一关。 这个其实OpenClaw早可以实现了,但是目前我觉得最大的区别是,Hermes会自主总结提炼,并更新你的写作技能。 相信就冲这一点,就值得一试。 这篇帖子主要就Hermes部署使用,作一个非常详细的介绍,几乎一步一贴图。 关于Hermes,无论你赞成哪种声音,我希望都是你自己动手行动过,发自内心的选择!
2483 25
|
30天前
|
人工智能 JSON 机器人
让龙虾成为你的“公众号分身” | 阿里云服务器玩Openclaw
本文带你零成本玩转OpenClaw:学生认证白嫖6个月阿里云服务器,手把手配置飞书机器人、接入免费/高性价比AI模型(NVIDIA/通义),并打造微信公众号“全自动分身”——实时抓热榜、AI选题拆解、一键发布草稿,5分钟完成热点→文章全流程!
45746 157
让龙虾成为你的“公众号分身” | 阿里云服务器玩Openclaw
|
6天前
|
人工智能 弹性计算 安全
Hermes Agent是什么?怎么部署?超详细实操教程
Hermes Agent 是 Nous Research 于2026年2月开源的自进化AI智能体,支持跨会话持久记忆、自动提炼可复用技能、多平台接入与200+模型切换,真正实现“越用越懂你”。MIT协议,部署灵活,隐私可控。
1722 3