《C#程序设计》课程设计公交路线查询.docx

上传人:b****4 文档编号:1386897 上传时间:2022-10-21 格式:DOCX 页数:35 大小:2.10MB
下载 相关 举报
《C#程序设计》课程设计公交路线查询.docx_第1页
第1页 / 共35页
《C#程序设计》课程设计公交路线查询.docx_第2页
第2页 / 共35页
《C#程序设计》课程设计公交路线查询.docx_第3页
第3页 / 共35页
《C#程序设计》课程设计公交路线查询.docx_第4页
第4页 / 共35页
《C#程序设计》课程设计公交路线查询.docx_第5页
第5页 / 共35页
点击查看更多>>
下载资源
资源描述

《C#程序设计》课程设计公交路线查询.docx

《《C#程序设计》课程设计公交路线查询.docx》由会员分享,可在线阅读,更多相关《《C#程序设计》课程设计公交路线查询.docx(35页珍藏版)》请在冰豆网上搜索。

《C#程序设计》课程设计公交路线查询.docx

《C#程序设计》课程设计公交路线查询

《C#程序设计》课程设计

 

公交路线查询系统

需求分析:

随着现代社会的发展,交通也越来越发达,人们也开始不断的外出旅游,不管是市内还是市外对一个准确明了的交通路线需求越来越大,以前我们只能通过电话咨询、看地图、向路人打听来了解讯息,这不仅浪费精力财力时间,而且极为不方便。

在这样一个需求下,我们所设计的公交路线查询系统就产生了很大的价值,它能很方便的查询到公交路线,准确的告诉你从A到B该怎么去才最为快捷!

这也是我们设计这个系统的初衷!

1.功能需求

首先我们系统最基本要满足顾客的需求就是公交路线的查询。

但是我们清楚的知道,死的列表将造成许多不便,因为路线会随着城市建设而变化,所以我们的路线是可以实时的去更新的,这样就牵扯到再数据库中的更新、删除功能,附带通过报表清楚的显示出来修改后的内容。

触发器功能实现公交路线中的一些数值计算,比如几站路等。

我们所要实现的就是站点查询、换车查询、线路查询。

2.数据需求

数据库中包含管理者的账户密码。

公交路线数据(包括起始站到终点站的其间所有站点)。

3.性能需求

客户需要的是一个快捷准确的查询系统,包括一次转车到达以及二次转车到达,不能有任何差错。

所以关于线路查询的C#程序语句要考虑周全不能有任何差池。

数据库中数据也需要其准确性。

概要设计:

设计思想:

随着公路规模的不断扩大,公交数量的急剧增加,有关公交管理的各种信息量也在不断成倍增长。

面对庞大的信息量,就需要有公交信息管理系统来提公交房管理工作的效率。

通过这样的系统,我们可以做到信息的规范管理和快速查询,从而减少了管理方面的工作量。

目前,我国各省市的公交查询工作还未实现数字化。

整个过程既浪费能源又浪费资源。

最后导致浪费时间,无法按时到达目的地。

因此,开发一个能够对最新的公交线路进行查询的信息平台就显得尤其重要。

所开发的系统将在一定程度上能够克服以上的种种缺点,实现各项工作在线完成,为乘客提供一个完全公开、开放、完善的管理平台,放便了乘客的出行,大大节省了乘客的宝贵时间。

通过这样的系统,我们可以做到信息的规范管理和快速查询,实现了公交信息管理的系统化、规范化和自动化,这样不仅减少了管理工作量,还提高了查询效率,降低了查询成本。

实现模块:

1.选择模块:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Text;

usingSystem.Windows.Forms;

namespacebus

{

publicpartialclassForm3:

Form

{

publicForm3()

{

InitializeComponent();

}

privatevoidbutton1_Click(objectsender,EventArgse)

{

if(radioButton1.Checked)

{

Form1f=newForm1();

f.Show();

this.Hide();

}

if(radioButton2.Checked)

{

Form2f=newForm2();

f.Show();

this.Hide();

}

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

Application.Exit();

}

privatevoidradioButton1_CheckedChanged(objectsender,EventArgse)

{

}

}

}

2.查询模块:

usingSystem;

usingSystem.Collections.Generic;

usingSystem.ComponentModel;

usingSystem.Data;

usingSystem.Drawing;

usingSystem.Text;

usingSystem.Windows.Forms;

usingSystem.IO;

namespacebus

{

publicpartialclassForm1:

Form

{

publicForm1()

{

InitializeComponent();

}

publicintn=0;

privatevoidbutton1_Click(objectsender,EventArgse)

{

string[]bus=newstring[10];

FileStreamfs=newFileStream("C:

\\DocumentsandSettings\\Administrator\\桌面\\buses\\bus\\MyFile.txt",FileMode.Open,FileAccess.Read);

StreamReadersr=newStreamReader(fs);

for(inti=0;i

{

bus[i]=sr.ReadLine();

if(bus[i]==null)

{

n++;

}

}

sr.Close();

  fs.Close();

if(++n==bus.Length)

{

MessageBox.Show("文件内容为空,请按读入文件按钮!

");

}

else

{

stringpath="";

if(textBox1.Text==""&&textBox2.Text=="")

{

MessageBox.Show("起始站台和目的站台不能为空!

");

}

elseif(textBox1.Text=="")

{

MessageBox.Show("起始站台不能为空!

");

}

elseif(textBox2.Text=="")

{

MessageBox.Show("目的站台不能为空!

");

}

for(inti=0;i

{

stringaa=bus[i];

if(aa!

=null)

{

if(aa.IndexOf(textBox1.Text)>0&&aa.IndexOf(textBox2.Text)>0)

{

string[]b=aa.Split(',');

path+=b[0];

}

if(path!

="")

{

textBox3.Text=path;

}

else

{

textBox3.Text="没有这路公交车,请选择查询2,查询交通路线!

";

}

}

}

}

}

publicstringret(stringa,stringb)

{

stringret="";

string[]a1=a.Split(',');

string[]b1=b.Split(',');

for(inti=0;i

{

for(intj=0;j

{

if(a1[i]==b1[j])

{

if(ret=="")

{

ret=a1[i];

}

else

{

ret+=","+a1[i];

}

}

}

}

returnret;

}

privatevoidbutton3_Click(objectsender,EventArgse)

{

string[]bus=newstring[10];

FileStreamfs=newFileStream("C:

\\DocumentsandSettings\\Administrator\\桌面\\buses\\bus\\MyFile.txt",FileMode.Open,FileAccess.Read);

StreamReadersr=newStreamReader(fs);

for(inti=0;i

{

bus[i]=sr.ReadLine();

}

sr.Close();

fs.Close();

stringpath="";

if(textBox1.Text==""&&textBox2.Text=="")

{

MessageBox.Show("起始站台和目的站台不能为空!

");

}

elseif(textBox1.Text=="")

{

MessageBox.Show("起始站台不能为空!

");

}

elseif(textBox2.Text=="")

{

MessageBox.Show("目的站台不能为空!

");

}

for(inti=0;i

{

stringaa=bus[i];

if(aa.IndexOf(textBox1.Text)>=0)

{

for(intj=0;j

{

if(i!

=j)

{

stringbb=bus[j];

if(bb.IndexOf(textBox2.Text)>=0)

{

for(ints=0;s

{

stringcc=bus[s];

if(i!

=j&&j!

=s&&s!

=i)

{

if(ret(aa,cc)!

=""&&ret(cc,bb)!

="")

{

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="转两次车不能到达,请选择打的!

";

}

}

}

}

}

}

}

}

}

privatevoidbutton2_Click(objectsender,EventArgse)

{

string[]bus=newstring[10];

FileStreamfs=newFileStream("C:

\\DocumentsandSettings\\Administrator\\桌面\\buses\\bus\\MyFile.txt",FileMode.Open,FileAccess.Re

展开阅读全文
相关资源
猜你喜欢
相关搜索
资源标签

当前位置:首页 > 小学教育 > 语文

copyright@ 2008-2022 冰豆网网站版权所有

经营许可证编号:鄂ICP备2022015515号-1