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

2021/4/11 18:31:16

本文主要是介绍项目:地铁收费系统 计应192西第五组 蔡瑜晶,对大家解决编程问题具有一定的参考价值,需要的程序猿们随着小编来一起学习吧!

需求分析:从收费的起点到终点收费系统                                                 时间: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

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



这篇关于项目:地铁收费系统 计应192西第五组 蔡瑜晶的文章就介绍到这儿,希望我们推荐的文章对大家有所帮助,也希望大家多多支持为之网!


扫一扫关注最新编程教程