2024.4.3

所学时间:2.5小时

代码行数:81

博客园数:1篇

所学知识:我们今天完成了结对作业的前端全部页面,完成了线路查询,站点查询,起始终点查询,线路查询,利用下拉框查询几号,点击查询。然后就是起始终点查询,输入起始点和终点,点击查询即可。站点查询,输入站点,点击查询。今天是我负责页面的撰写,张雨锟负责测试。

package com.example.niumo67.ut;

import com.example.niumo67.Subway.GetInfo;
import com.example.niumo67.Subway.Station;
import com.example.niumo67.Subway.SubwayLine;

import java.sql.SQLException;
import java.text.ParseException;

public class Find {
public static String find(String line) throws ParseException, SQLException, ClassNotFoundException {
GetInfo getInfo =GetInfo.getGetInfo();
Station station = new Station();
SubwayLine subwayLine = new SubwayLine();
boolean hasfind = false;
String passStation = line;
for (int i = 0; i < getInfo.lines.size(); i++) {
subwayLine = getInfo.lines.get(i);
if (line.equals(subwayLine.name)) {
hasfind = true;
for (Station st : subwayLine.stations) {
passStation += st.name + "->";
}
}
}
passStation = passStation.substring(0,passStation.length()-2);
if (!hasfind)
{
System.out.println("线路查询失败!");
passStation="线路查询失败";
}
return passStation;

}
}

 

posted @ 2024-04-03 22:50  kuku睡  阅读(10)  评论(0编辑  收藏  举报