码迷,mamicode.com
首页 > 其他好文 > 详细

项目:地铁收费系统 计应192西第五组 蔡瑜晶

时间:2021-04-12 12:46:33      阅读:0      评论:0      收藏:0      [点我收藏+]

标签:页面   sys   system   总结   设计文档   cut   exce   Servle   驼峰   

需求分析从收费的起点到终点收费系统                                                 时间:3minutes

设计文档:3label 2button 1comboBox                                               时间:5minutes

设计复审:李娟娟复审                                                                             时间:20minutes                                       

代码规范:使用驼峰式命名                    时间:3minutes                                      

具体设计: 输入两个数字得出正确的结果             时间 2minutes

具体编码如下:                                                                                      时间:1.5taday

窗体界面:         

 static int getNum(String name)

 {String sql = "select xianluhao from aaa where name =‘" + name + "‘";Connection conn = DBUtil.getConn()

;Statement state = null;

ResultSet rs = null;int number=0;

rs = state.executeQuery(sql);

while (rs.next()) {number = rs.getInt("xianluhao");}} catch (Exception e) {e.printStackTrace();}

finally {DBUtil.close(rs, state, conn);}

return number;}

public static int getZhanhao(String name) {String sql = "select num from aaa where name =‘" + name + "‘";Connection conn = DBUtil.

getConn();Statement state = null;

ResultSet rs = null;int zhanhao=0;

return zhanhao;}

public static String getLine1(int zhanhao1,int zhanhao2)

{String line="";String sql = "select name from aaa where num between ‘"+zhanhao1+"‘ and ‘"+zhanhao2+"‘order by num ASC ";

Connection conn = DBUtil.getConn();

Statement state = null;

ResultSet rs = null;try {state = conn.createStatement();

rs = state.executeQuery(sql);

if(rs.next())line=rs.getString("name");

while (rs.next()) {String name=rs.getString("name");

line=line+"->"+name;}     }

catch (Exception e) {e.printStackTrace();

}

return line;}

public static String getLine2(int zhanhao1,int zhanhao2)

 {

String line="";String sql = "select name from aaa where num between ‘"+zhanhao1+"‘ and ‘"+zhanhao2+"‘  order by num DESC ";

Connection conn = DBUtil.getConn();

Statement state = null;ResultSet rs = null;

rs = state.executeQuery(sql);

if(rs.next())line=rs.getString("name");while

(rs.next()){String name=rs.getString("name");line=line+"->"+name;

}     } {e.printStackTrace();     }   

}return line;}}  

package servlet;

if ("chaxun".equals(method)) {chaxun(req, resp);} }

private void chaxun(HttpServletRequest req, HttpServletResponse resp) throws ServletException,  String zhong=req.getParameter("zhong");

int zhanhao1=dao.getZhanhao(qi);

 int zhanhao2=dao.getZhanhao(zhong);

 int number1=dao.getNum(qi);

 int number2=dao.getNum(zhong);

if(number1==number2)

{if(zhanhao1<zhanhao2){Stringline=dao.getLine1(zhanhao1, zhanhao2);req.setAttribute("line",line );

req.setAttribute("num",number1);

req.getRequestDispatcher("list.jsp").forward(req,resp);

}

if(zhanhao1>zhanhao2){String line=dao.getLine2(zhanhao2, zhanhao1);

System.out.r("list.jsp").forward(req,resp);}}}} 

print(line);req.setAttribute("num",number1);req.setAttribute("line",line );req.getRequestDispatche

 窗口界面:项目总结分析:这个项目因为涉及到一个最短路径的问题。

 

代码复审:在头脑里过一遍代码                       时间:3minutes

测试:弹出的页面执行结果正确                      时间:2minutes

测试报告:没有问题功能实现                        时间:1minutes

计算工作量:                                                时间:2taday

总结:多动手是可以快速找出自己的问题所在

项目:地铁收费系统 计应192西第五组 蔡瑜晶

标签:页面   sys   system   总结   设计文档   cut   exce   Servle   驼峰   

原文地址:https://www.cnblogs.com/aiziji1314/p/14644613.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!