




版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领
文档简介
1、太湖学院c#程序设计课程设计题目:公交路线查询机 电学院计算机科学与技术专业学 号:学生姓名:班 级:计科84成 绩:2012年 1月 需求分析:随着现代社会的发展,交通也越来越发达,人们也开始不断的外出旅游,不管是市内还是市外对一个准确明了的交通路线需求越来越大,以前我们只能通过电话咨询、看地图、向路人打听来了解讯息,这不仅浪费精力财力时间,而且极为不方便。在这样一个需求下,我们所设计的公交路线查询系统就产生了很大的价值,它能很方便的查询到公交路线,准确的告诉你从a到b该怎么去才最为快捷!这也是我们设计这个系统的初衷!1.功能需求首先我们系统最基本要满足顾客的需求就是公交路线的查询。但是我们
2、清楚的知道,死的列表将造成许多不便,因为路线会随着城市建设而变化,所以我们的路线是可以实时的去更新的,这样就牵扯到再数据库中的更新、删除功能,附带通过报表清楚的显示出来修改后的内容。触发器功能实现公交路线中的一些数值计算,比如几站路等。我们所要实现的就是站点查询、换车查询、线路查询。2.数据需求数据库中包含管理者的账户密码。公交路线数据(包括起始站到终点站的其间所有站点)。3.性能需求客户需要的是一个快捷准确的查询系统,包括一次转车到达以及二次转车到达,不能有任何差错。所以关于线路查询的c#程序语句要考虑周全不能有任何差池。数据库中数据也需要其准确性。概要设计:设计思想: 随着公路规模的不断扩
3、大,公交数量的急剧增加,有关公交管理的各种信息量也在不断成倍增长。面对庞大的信息量,就需要有公交信息管理系统来提公交房管理工作的效率。通过这样的系统,我们可以做到信息的规范管理和快速查询,从而减少了管理方面的工作量。目前,我国各省市的公交查询工作还未实现数字化。整个过程既浪费能源又浪费资源。最后导致浪费时间,无法按时到达目的地。因此,开发一个能够对最新的公交线路进行查询的信息平台就显得尤其重要。所开发的系统将在一定程度上能够克服以上的种种缺点,实现各项工作在线完成,为乘客提供一个完全公开、开放、完善的管理平台,放便了乘客的出行,大大节省了乘客的宝贵时间。通过这样的系统,我们可以做到信息的规范管
4、理和快速查询,实现了公交信息管理的系统化、规范化和自动化,这样不仅减少了管理工作量,还提高了查询效率,降低了查询成本。实现模块:1. 选择模块:using system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.text;using system.windows.forms;namespace bus public partial class form3 : form public form3() initial
5、izecomponent(); private void button1_click(object sender, eventargs e) if (radiobutton1.checked) form1 f=new form1(); f.show(); this.hide(); if(radiobutton2.checked) form2 f = new form2(); f.show(); this.hide(); private void button2_click(object sender, eventargs e) application.exit(); private void
6、radiobutton1_checkedchanged(object sender, eventargs e) 2. 查询模块:using system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.text;using system.windows.forms;using system.io;namespace bus public partial class form1 : form public form1()
7、 initializecomponent(); public int n = 0; private void button1_click(object sender, eventargs e) string bus = new string10; filestream fs = new filestream("c:documents and settingsadministrator桌面busesbusmyfile.txt", filemode.open, fileaccess.read); streamreader sr = new streamreader(fs); f
8、or (int i = 0; i < bus.length; i+) busi = sr.readline(); if (busi = null) n+; sr.close(); fs.close(); if (+n = bus.length) messagebox.show("文件内容为空,请按读入文件按钮!"); else string path = "" if (textbox1.text = "" && textbox2.text = "") messagebox.show("
9、;起始站台和目的站台不能为空!"); else if (textbox1.text = "") messagebox.show("起始站台不能为空!"); else if (textbox2.text = "") messagebox.show("目的站台不能为空!"); for (int i = 0; i < bus.length; i+) string aa = busi; if (aa != null) if (aa.indexof(textbox1.text) > 0 &&am
10、p; aa.indexof(textbox2.text) > 0) string b = aa.split(','); path += b0; if (path != "") textbox3.text = path; else textbox3.text = "没有这路公交车,请选择查询2,查询交通路线!" public string ret(string a, string b) string ret = "" string a1 = a.split(','); string b1 = b.s
11、plit(','); for (int i =0; i <a1.length;i+ ) for (int j = 0; j <b1.length; j+) if (a1i = b1j) if (ret ="") ret = a1i; else ret += "," + a1i; return ret; private void button3_click(object sender, eventargs e) string bus = new string10; filestream fs = new filestream(&
12、quot;c:documents and settingsadministrator桌面busesbusmyfile.txt", filemode.open, fileaccess.read); streamreader sr = new streamreader(fs); for (int i = 0; i < bus.length; i+) busi = sr.readline(); sr.close(); fs.close(); string path = "" if (textbox1.text = "" && t
13、extbox2.text = "") messagebox.show("起始站台和目的站台不能为空!"); else if (textbox1.text = "") messagebox.show("起始站台不能为空!"); else if (textbox2.text = "") messagebox.show("目的站台不能为空!"); for (int i = 0; i < bus.length; i+) string aa = busi; if (aa.inde
14、xof(textbox1.text) >= 0) for (int j = 0; j < bus.length; j+) if (i != j) string bb = busj; if (bb.indexof(textbox2.text) >= 0) for (int s = 0; s < bus.length; s+) string cc = buss; if (i != j && j != s && s != i) if (ret(aa, cc) != "" && ret(cc, bb) != &
15、quot;") path += aa.substring(0, 4) + "到" + ret(aa, cc) + "转" + cc.substring(0, 4) + "到" + ret(cc, bb) + "转" + bb.substring(0, 4) + "到" + textbox2.text; if (path != "") textbox3.text = path; else textbox3.text = "转两次车不能到达,请选择打的!&qu
16、ot; private void button2_click(object sender, eventargs e) string bus = new string10; filestream fs = new filestream("c:documents and settingsadministrator桌面busesbusmyfile.txt", filemode.open, fileaccess.read); streamreader sr = new streamreader(fs); for (int i = 0; i < bus.length; i+)
17、busi = sr.readline(); sr.close(); fs.close(); string path = "" if (textbox1.text = "" && textbox2.text = "") messagebox.show("起始站台和目的站台不能为空!"); else if (textbox1.text = "") messagebox.show("起始站台不能为空!"); else if (textbox2.text = &quo
18、t;") messagebox.show("目的站台不能为空!"); for (int i=0; i <bus.length; i+) string aa=busi; if (aa.indexof(textbox1.text) >= 0) for (int j = 0; j < bus.length;j+) if (i != j) string bb = busj; if (bb.indexof(textbox2.text) >= 0) if (ret(aa, bb) != "") path += aa.substrin
19、g(0, 4) + "到" + ret(aa, bb) + '转' + bb.substring(0, 4) + "到" + textbox2.text; if (path != "") textbox3.text = path; else textbox3.text = "转一次车不能到达,请选择查询2,查询交通路线!" private void button4_click(object sender, eventargs e) filestream fs = new filestream(&qu
20、ot;c:documents and settingsadministrator桌面busesbusmyfile.txt", filemode.open, fileaccess.readwrite); streamwriter sw = new streamwriter(fs); string bus = new string10; bus0 = "#001,火车站,吉祥桥,胜利门,五爱北路,梁溪大桥,运河饭店,开源大桥,蠡桥,北桥,稻香新村,中桥,景亭苑,震泽新村,旺山路,蠡湖大桥,蠡湖公园,蠡湖广场,蠡园,宝界桥,宝界村,鼋头渚" bus1 = "#
21、002,梅园公交总站,梅园,开原寺,大渲,公益路,荣巷,张巷,第九人民医院,上里东,河埒口" bus2 = "#003,梓旺新村,东方名苑,东北塘,锦旺苑,夏氏物流,东风桥木材市场,金龙纸品,向阳,广丰,丁村" bus3 = "#004,胡埭停车场,胡埭路,钱胡路,张舍,刘塘村,文良路,历村,洋溪桥,江南皮件厂" bus4 = "#005,无锡动物园,西山,东山,江原医院,无锡艺校,开源寺,梅园,梅园公交总站" bus5 = "#006,钱桥,杨树岸,惠钱路,惠泉花园,石门路,严家鹏,烈士陵园,凤翔南路,惠畅里,惠
22、山,龙光路,威孚公司,五爱广场,西门,复兴路" bus6 = "#007,锡山医院,锡沪路,市人力资源,长庆路,东林书院,检察院,三凤桥,二院,朝阳广场,文化宫,体育公园,健康桥,梁溪大桥" bus7 = "#008,火车站,胜利门,商业大厦,八百伴,解放东路,风雷新村,金海里,叙康里," bus8 = "#009,河埒口,四院,青山湾,青山支路,锡惠公园,吟苑公园,五爱广场,五爱北路,胜利门,吉祥桥,火车站" bus9 = "#010,中桥,景亭苑,震泽新村,旺山路,蠡湖大桥,蠡湖公园,蠡湖广场,蠡园,宝界桥,宝
23、界村,鼋头渚" for (int i = 0; i < bus.length; i+) sw.writeline(busi); sw.close(); fs.close(); private void button5_click(object sender, eventargs e) form3 f = new form3(); f.show(); this.hide(); private void button6_click(object sender, eventargs e) application.exit(); 3. 修改模块:using system;using s
24、ystem.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.text;using system.windows.forms;using system.io;namespace bus public partial class form2 : form public form2() initializecomponent(); private void button1_click(object sender, eventargs e) strin
25、g bus = new string10; filestream fs = new filestream("c:documents and settingsadministrator桌面busesbusmyfile.txt", filemode.open, fileaccess.read); streamreader sr = new streamreader(fs); for (int i = 0; i < bus.length; i+) busi = sr.readline(); sr.close(); fs.close(); for (int i = 0; i
26、< bus.length; i+) string aa = busi; string a1 =aa.split(','); if ( a10= textbox1.text) textbox3.text = busi; break; else messagebox.show("输入的线路不正确!"); break; private void button2_click(object sender, eventargs e) form3 f = new form3(); f.show(); this.hide(); private void button3
27、_click(object sender, eventargs e) application.exit(); private void button4_click(object sender, eventargs e) string bus = new string10; filestream fs = new filestream("c:documents and settingsadministrator桌面busesbusmyfile.txt", filemode.open, fileaccess.read); streamreader sr = new stream
28、reader(fs); for (int i = 0; i < bus.length; i+) busi = sr.readline(); sr.close(); fs.close(); for (int i = 0; i < bus.length; i+) string aa = busi; string a1 = aa.split(','); if (textbox1.text = a10) busi = textbox3.text; filestream fst = new filestream("c:documents and settingsad
29、ministrator桌面busesbusmyfile.txt", filemode.create, fileaccess.readwrite); streamwriter sw = new streamwriter(fst); for (int i = 0; i < bus.length; i+) sw.writeline(busi); sw.close(); fst.close(); 详细设计:(1)设计说明:当打开软件时首先选择所需功能,代码如下:using system;using system.collections.generic;using system.comp
30、onentmodel;using system.data;using system.drawing;using system.text;using system.windows.forms;namespace bus public partial class form3 : form public form3() initializecomponent(); private void button1_click(object sender, eventargs e) if (radiobutton1.checked) form1 f=new form1(); f.show(); this.hi
31、de(); if(radiobutton2.checked) form2 f = new form2(); f.show(); this.hide(); private void button2_click(object sender, eventargs e) application.exit(); private void radiobutton1_checkedchanged(object sender, eventargs e) 当选择查询时,首先写入文件,然后分别有转一次车查询和转两次车查询,代码如下:using system;using system.collections.gen
32、eric;using system.componentmodel;using system.data;using system.drawing;using system.text;using system.windows.forms;using system.io;namespace bus public partial class form1 : form public form1() initializecomponent(); public int n = 0; private void button1_click(object sender, eventargs e) string b
33、us = new string10; filestream fs = new filestream("c:documents and settingsadministrator桌面busesbusmyfile.txt", filemode.open, fileaccess.read); streamreader sr = new streamreader(fs); for (int i = 0; i < bus.length; i+) busi = sr.readline(); if (busi = null) n+; sr.close(); fs.close();
34、if (+n = bus.length) messagebox.show("文件内容为空,请按读入文件按钮!"); else string path = "" if (textbox1.text = "" && textbox2.text = "") messagebox.show("起始站台和目的站台不能为空!"); else if (textbox1.text = "") messagebox.show("起始站台不能为空!"); else if (textbox2.text = "&qu
温馨提示
- 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
- 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
- 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
- 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
- 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
- 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
- 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。
最新文档
- 鱼塘土方开挖施工方案
- 蚌埠九年级二模数学试卷
- 2025年高性能纤维超细纤维项目建议书
- 灞桥工程铁艺花箱施工方案
- 2025年柔印CTP项目发展计划
- 马凳筋专项施工方案
- 渠道预制板衬砌施工方案
- 多重发展模式在林业高效种植中的应用价值及实现路径探讨
- 基本医疗卫生服务面临的主要问题
- 流动式起重机分解组塔施工方案
- 40米落地式脚手架专项施工方案
- 虚拟现实环境中的自然交互技术与算法
- 质量手册和质量管理手册
- 志愿服务与志愿者精神知识考试题库大全(含答案)
- 2024年北京电子科技职业学院高职单招(英语/数学/语文)笔试题库含答案解析
- 运维人员安全培训内容记录
- 独股一箭2010年20w实盘
- 人员伤亡事故应急措施及救援预案
- 企业安全与风险管控课件
- 苏教版四年级科学下册单元测试卷及答案(全册)
- 墙板安装施工工艺指导手册
评论
0/150
提交评论