软件工程个人作业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

 

 

 

目录
相关文章
|
机器学习/深度学习 人工智能 自然语言处理
算法金 | AI 基石,无处不在的朴素贝叶斯算法
```markdown 探索贝叶斯定理:从默默无闻到AI基石。18世纪数学家贝叶斯的理论,初期未受重视,后成为20世纪机器学习、医学诊断和金融分析等领域关键。贝叶斯定理是智能背后的逻辑,朴素贝叶斯分类器在文本分类等应用中表现出色。贝叶斯网络则用于表示变量间条件依赖,常见于医学诊断和故障检测。贝叶斯推理通过更新信念以适应新证据,广泛应用于统计和AI。尽管有计算复杂性等局限,贝叶斯算法在小数据集和高不确定性场景中仍极具价值。了解并掌握这一算法,助你笑傲智能江湖! ```
270 2
算法金 | AI 基石,无处不在的朴素贝叶斯算法
|
9月前
|
测试技术
Squaretest自动生成单元测试
Squaretest自动生成单元测试
279 8
Squaretest自动生成单元测试
|
9月前
|
人工智能 JSON 自然语言处理
AI 程序员的4个分身 | 代码生成专家+注释精灵+API集成助手+智能调试伙伴
AI 程序员的4个分身 | 代码生成专家+注释精灵+API集成助手+智能调试伙伴
431 35
|
10月前
|
Web App开发 Linux C#
C# 网页截图全攻略:三种技术与 Chrome 路径查找指南
本文主要介绍了在 C# 中实现网页截图的几种技术及相关要点。涵盖了 PuppeteerSharp、Selenium 和 HtmlToImage 三种方式,分别阐述了它们的安装步骤及核心代码。同时,针对在 C# 中寻找 Windows 上 chrome.exe 路径这一问题,分析了未安装 Google Chrome 和已安装两种情况下的查找原因,并给出了相关参考链接,还列举了一系列与 C# 使用 Selenium、获取 chrome.exe 路径以及在 Linux 上部署相关的参考资料。
394 11
|
网络协议 SDN 数据中心
VXLAN的应用场景
VXLAN技术用于云数据中心间虚拟机迁移,确保迁移过程中业务连续性和网络无感知。通过在虚拟机上联交换机配置VXLAN信息,建立VXLAN隧道和网关,实现跨数据中心的大范围二层网络连接。在SDN环境下,SDN控制器可管理VXLAN的IP和VID对应关系,提高灵活性与扩展性。
447 3
|
运维 网络性能优化 网络虚拟化
|
弹性计算 固态存储 数据可视化
阿里云服务器一年价格2023最新价格明细来了
阿里云服务器一年价格2023最新价格明细来了。阿里云服务器分为云服务器ECS和轻量应用服务器,云服务器s6公网带宽可选1M到5M,系统盘40G起可选高效云盘、SSD云盘或ESSD云盘,1核1G配置19.17元3个月、306.72元一年,1核2G优惠价26.46元3个月、423.36元一年,2核4G配置42.66元3个月,2核8G配置58.86元3个月,4核8G 75.06元3个月,8核16G 139.86元3个月,还有4核16G、8核32G多配置可选。不只是云服务器ECS共享型s6实例,ECS计算型c6、通用型g6、内存型r6、云服务器u1、企业级c7/g7/r7系列、轻量应用服务器和GPU云
932 0
|
Android开发 Kotlin
kotlin开发安卓应用 如何修改app安装后的名称
在 Android 应用中,要修改安装后的显示名称,需更新 AndroidManifest.xml 文件中 application 标签的 android:label 属性。可直接在该属性内设置新名称,或在 res/values/strings.xml 文件中修改 app_name 并在 manifest 中引用。推荐使用 strings.xml 方式,以便支持多语言和集中管理。
|
存储 运维 Kubernetes
基于rancher部署k8s及使用
基于rancher部署k8s及使用
851 2
|
缓存 算法 索引
【Elasticsearch专栏 07】深入探索:Elasticsearch的倒排索引如何进行模糊查询和通配符查询
Elasticsearch的倒排索引支持模糊查询和通配符查询,通过特定的算法和数据结构,能够实现对关键词的模糊匹配和通配符匹配。这两种查询类型提供了更灵活的搜索功能,但可能影响查询性能,需结合优化策略使用。
613 0