结对开发地铁
要求:
要求:
1.开发一套石家庄地铁线路查询系统。
2.功能设计
(1)数据库设计:将石家庄地铁线路图的各个线路,各个站点,换乘信息等用数据库的形式保存起来,应该保存的信息有 {线路号,线路的各个站名,车站的换乘信息}。
(2)站点查询:用户可以输入任一一条线路或输入出发地和目的地信息,可以查询到相关内容。
例如输入出发地:石家庄铁道大学 目的地 博物院
返回经历的站名的个数,和路径,如果有换乘,请列出换乘的线路
搭档:高欣跃
设计思路:
通过数组储存下来站点信息,依靠if else 语句判断起始点与终点是否为一条地铁线,依赖于两个input表格写入并读取信息
部分数据库内容展示:
代码:
login.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@page import="gxy.Metro" %> <%@page import="gxy.MetroDao" %> <%@page import="java.util.List" %> <%@page import="java.util.ArrayList" %> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html> <html> <head> <meta charset="utf-8"> <title>显示全部信息</title> </head> <body> <table> <tr> <td>站台</td> <td>线路</td> </tr> <tr> <c:forEach items="${users}" var="item"> <tr> <td>${item.line}</td> <td>${item.name}</td> </tr> </c:forEach> </table> **********************<br> <input type="button" value="返回功能界面" οnclick="window.location.href='index.jsp';"/><br> **********************<br> </body> </html>
index.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
</head>
<body>
<a href="MetroServlet?method=list">站名列表</a>
<div class="a">
<a href="query.jsp">查询界面</a>
</div>
</body>
</html>
list.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <style> .a{ margin-top: 20px; } .b{ font-size: 20px; width: 160px; color: white; background-color: greenyellow; } .tb, td { border: 1px solid black; font-size: 22px; } </style> </head> <body> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <h1 style="color: red;">石家庄地铁站信息列表</h1> <a href="index.jsp">返回主页</a> <table class="tb"> <tr> <td>id</td> <td>线路</td> <td>站名</td> </tr> <c:forEach items="${metros}" var="item"> <tr> <td>${item.id}</td> <td>${item.line}</td> <td>${item.name}</td> </tr> </c:forEach> </table> </div> </body> </html>
del.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <style> .a{ margin-top: 20px; } .b{ font-size: 20px; width: 160px; color: white; background-color: greenyellow; } </style> </head> <body> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <h1 style="color: red;">课程信息删除</h1> <a href="index.jsp">返回主页</a> <form action="CourseServlet?method=getcoursebyname" method="post" οnsubmit="return check()"> <div class="a"> 课程名称<input type="text" id="name" name="name"/> </div> <div class="a"> <button type="submit" class="b">查 找</button> </div> </form> </div> <script type="text/javascript"> function check() { var name = document.getElementById("name");; //非空 if(name.value == '') { alert('课程名称为空'); name.focus(); return false; } } </script> </body> </html>
detail,jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <style> .a{ margin-top: 20px; } .b{ font-size: 20px; width: 160px; color: white; background-color: greenyellow; } .tb, td { border: 1px solid black; font-size: 22px; } </style> </head> <body> <div align="center"> <h1 style="color: red;">课程信息删除</h1> <a href="index.jsp">返回主页</a> <table class="tb"> <tr> <td>课程名称</td> <td>${course.name}</td> </tr> <tr> <td>任课教师</td> <td>${course.teacher}</td> </tr> <tr> <td>上课地点</td> <td>${course.classroom}</td> </tr> </table> <div class="a"> <a οnclick="return check()" href="CourseServlet?method=del&id=${course.id}">删 除</a> </div> </div> <script type="text/javascript"> function check() { if (confirm("真的要删除吗?")){ return true; }else{ return false; } } </script> </body> </html>
query.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> <title>Insert title here</title> </head> <body> <% Object message = request.getAttribute("message"); if(message!=null && !"".equals(message)){ %> <script type="text/javascript"> alert("<%=request.getAttribute("message")%>"); </script> <%} %> <div align="center"> <h1 style="color: red;">通过站名查询路线</h1> <a href="index.jsp">返回主页</a> <form action="MetroServlet?method=search" method="post" οnsubmit="return check()"> <div class="a"> 起始站<input type="text" id="sname" name="sname"/> </div> <div class="a"> 终点站<input type="text" id="ename" name="ename" /> </div> <div class="a"> <button type="submit" class="b">查 询</button> </div> </form> </div> </body> </html>
searchlist.jsp
<%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"%> <%@taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c"%> <!DOCTYPE html> <html> <head> <meta charset="UTF-8"> <title>Insert title here</title> <style> .a{ margin-top: 20px; } .b{ font-size: 20px; width: 160px; color: white; background-color: greenyellow; } .tb, td { border: 1px solid black; font-size: 22px; } </style> </head> <body> <div align="center"> <h1 style="color: red;">课程信息列表</h1> <a href="index.jsp">返回主页</a> <table class="tb"> <tr> <td>id</td> <td>线路</td> <td>站名</td> </tr> <!-- forEach遍历出adminBeans --> <c:forEach items="${metros}" var="item" varStatus="status"> <tr> <td>${item.id}</td> <td><a>${item.line}</a></td> <td>${item.name}</td> </tr> </c:forEach> </table> </div> </body> </html>
PSP2.1 |
Personal Software Process Stages |
预估耗时(分钟) |
实际耗时(分钟) |
Planning |
计划 |
|
|
· Estimate |
· 估计这个任务需要多少时间 |
10 |
5 |
Development |
开发 |
|
|
· Analysis |
· 需求分析 (包括学习新技术) |
300 |
400 |
· Design Spec |
· 生成设计文档 |
20 |
10 |
· Design Review |
· 设计复审 (和同事审核设计文档) |
25 |
20 |
· Coding Standard |
· 代码规范 (为目前的开发制定合适的规范) |
30 |
0 |
· Design |
· 具体设计 |
80 |
100 |
· Coding |
· 具体编码 |
120 |
160 |
· Code Review |
· 代码复审 |
30 |
20 |
· Test |
· 测试(自我测试,修改代码,提交修改) |
100 |
200 |
Reporting |
报告 |
|
|
· Test Report |
· 测试报告 |
40 |
0 |
· Size Measurement |
· 计算工作量 |
10 |
5 |
· Postmortem & Process Improvement Plan |
· 事后总结, 并提出过程改进计划 |
40 |
20 |
|
合计 |
805 |
940 |