ICode9

精准搜索请尝试: 精确搜索
首页 > 其他分享> 文章详细

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

2021-04-11 17:32:49  阅读:148  来源: 互联网

标签:String rs 蔡瑜晶 req 192 int 第五组 line name


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

设计文档:3个label 2个button 1个comboBox                                               时间: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

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

标签:String,rs,蔡瑜晶,req,192,int,第五组,line,name
来源: https://www.cnblogs.com/aiziji1314/p/14644613.html

本站声明: 1. iCode9 技术分享网(下文简称本站)提供的所有内容,仅供技术学习、探讨和分享;
2. 关于本站的所有留言、评论、转载及引用,纯属内容发起人的个人观点,与本站观点和立场无关;
3. 关于本站的所有言论和文字,纯属内容发起人的个人观点,与本站观点和立场无关;
4. 本站文章均是网友提供,不完全保证技术分享内容的完整性、准确性、时效性、风险性和版权归属;如您发现该文章侵犯了您的权益,可联系我们第一时间进行删除;
5. 本站为非盈利性的个人网站,所有内容不会用来进行牟利,也不会利用任何形式的广告来间接获益,纯粹是为了广大技术爱好者提供技术内容和技术思想的分享性交流网站。

专注分享技术,共同学习,共同进步。侵权联系[81616952@qq.com]

Copyright (C)ICode9.com, All Rights Reserved.

ICode9版权所有