《C#程序設(shè)計(jì)》課程設(shè)計(jì)公交路線(xiàn)查詢(xún)_第1頁(yè)
《C#程序設(shè)計(jì)》課程設(shè)計(jì)公交路線(xiàn)查詢(xún)_第2頁(yè)
《C#程序設(shè)計(jì)》課程設(shè)計(jì)公交路線(xiàn)查詢(xún)_第3頁(yè)
《C#程序設(shè)計(jì)》課程設(shè)計(jì)公交路線(xiàn)查詢(xún)_第4頁(yè)
《C#程序設(shè)計(jì)》課程設(shè)計(jì)公交路線(xiàn)查詢(xún)_第5頁(yè)
已閱讀5頁(yè),還剩25頁(yè)未讀, 繼續(xù)免費(fèi)閱讀

下載本文檔

版權(quán)說(shuō)明:本文檔由用戶(hù)提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權(quán),請(qǐng)進(jìn)行舉報(bào)或認(rèn)領(lǐng)

文檔簡(jiǎn)介

1、太湖學(xué)院c#程序設(shè)計(jì)課程設(shè)計(jì)題目:公交路線(xiàn)查詢(xún)機(jī) 電學(xué)院計(jì)算機(jī)科學(xué)與技術(shù)專(zhuān)業(yè)學(xué) 號(hào):學(xué)生姓名:班 級(jí):計(jì)科84成 績(jī):2012年 1月 需求分析:隨著現(xiàn)代社會(huì)的發(fā)展,交通也越來(lái)越發(fā)達(dá),人們也開(kāi)始不斷的外出旅游,不管是市內(nèi)還是市外對(duì)一個(gè)準(zhǔn)確明了的交通路線(xiàn)需求越來(lái)越大,以前我們只能通過(guò)電話(huà)咨詢(xún)、看地圖、向路人打聽(tīng)來(lái)了解訊息,這不僅浪費(fèi)精力財(cái)力時(shí)間,而且極為不方便。在這樣一個(gè)需求下,我們所設(shè)計(jì)的公交路線(xiàn)查詢(xún)系統(tǒng)就產(chǎn)生了很大的價(jià)值,它能很方便的查詢(xún)到公交路線(xiàn),準(zhǔn)確的告訴你從a到b該怎么去才最為快捷!這也是我們?cè)O(shè)計(jì)這個(gè)系統(tǒng)的初衷!1.功能需求首先我們系統(tǒng)最基本要滿(mǎn)足顧客的需求就是公交路線(xiàn)的查詢(xún)。但是我們

2、清楚的知道,死的列表將造成許多不便,因?yàn)槁肪€(xiàn)會(huì)隨著城市建設(shè)而變化,所以我們的路線(xiàn)是可以實(shí)時(shí)的去更新的,這樣就牽扯到再數(shù)據(jù)庫(kù)中的更新、刪除功能,附帶通過(guò)報(bào)表清楚的顯示出來(lái)修改后的內(nèi)容。觸發(fā)器功能實(shí)現(xiàn)公交路線(xiàn)中的一些數(shù)值計(jì)算,比如幾站路等。我們所要實(shí)現(xiàn)的就是站點(diǎn)查詢(xún)、換車(chē)查詢(xún)、線(xiàn)路查詢(xún)。2.數(shù)據(jù)需求數(shù)據(jù)庫(kù)中包含管理者的賬戶(hù)密碼。公交路線(xiàn)數(shù)據(jù)(包括起始站到終點(diǎn)站的其間所有站點(diǎn))。3.性能需求客戶(hù)需要的是一個(gè)快捷準(zhǔn)確的查詢(xún)系統(tǒng),包括一次轉(zhuǎn)車(chē)到達(dá)以及二次轉(zhuǎn)車(chē)到達(dá),不能有任何差錯(cuò)。所以關(guān)于線(xiàn)路查詢(xún)的c#程序語(yǔ)句要考慮周全不能有任何差池。數(shù)據(jù)庫(kù)中數(shù)據(jù)也需要其準(zhǔn)確性。概要設(shè)計(jì):設(shè)計(jì)思想: 隨著公路規(guī)模的不斷擴(kuò)

3、大,公交數(shù)量的急劇增加,有關(guān)公交管理的各種信息量也在不斷成倍增長(zhǎng)。面對(duì)龐大的信息量,就需要有公交信息管理系統(tǒng)來(lái)提公交房管理工作的效率。通過(guò)這樣的系統(tǒng),我們可以做到信息的規(guī)范管理和快速查詢(xún),從而減少了管理方面的工作量。目前,我國(guó)各省市的公交查詢(xún)工作還未實(shí)現(xiàn)數(shù)字化。整個(gè)過(guò)程既浪費(fèi)能源又浪費(fèi)資源。最后導(dǎo)致浪費(fèi)時(shí)間,無(wú)法按時(shí)到達(dá)目的地。因此,開(kāi)發(fā)一個(gè)能夠?qū)ψ钚碌墓痪€(xiàn)路進(jìn)行查詢(xún)的信息平臺(tái)就顯得尤其重要。所開(kāi)發(fā)的系統(tǒng)將在一定程度上能夠克服以上的種種缺點(diǎn),實(shí)現(xiàn)各項(xiàng)工作在線(xiàn)完成,為乘客提供一個(gè)完全公開(kāi)、開(kāi)放、完善的管理平臺(tái),放便了乘客的出行,大大節(jié)省了乘客的寶貴時(shí)間。通過(guò)這樣的系統(tǒng),我們可以做到信息的規(guī)范管

4、理和快速查詢(xún),實(shí)現(xiàn)了公交信息管理的系統(tǒng)化、規(guī)范化和自動(dòng)化,這樣不僅減少了管理工作量,還提高了查詢(xún)效率,降低了查詢(xún)成本。實(shí)現(xiàn)模塊: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. 查詢(xún)模塊: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); for (int i =

8、0; i bus.length; i+) busi = sr.readline(); if (busi = null) n+; sr.close(); fs.close(); if (+n = bus.length) messagebox.show(文件內(nèi)容為空,請(qǐng)按讀入文件按鈕!); else string path = ; if (textbox1.text = & textbox2.text = ) messagebox.show(起始站臺(tái)和目的站臺(tái)不能為空!); else if (textbox1.text = ) messagebox.show(起始站臺(tái)不能為空!); else if

9、 (textbox2.text = ) messagebox.show(目的站臺(tái)不能為空!); for (int i = 0; i 0 & aa.indexof(textbox2.text) 0) string b = aa.split(,); path += b0; if (path != ) textbox3.text = path; else textbox3.text = 沒(méi)有這路公交車(chē),請(qǐng)選擇查詢(xún)2,查詢(xún)交通路線(xiàn)!; public string ret(string a, string b) string ret = ; string a1 = a.split(,); string

10、b1 = b.split(,); 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(c:documents and settingsadministrat

11、or桌面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 = & textbox2.text = ) messagebox.show(起始站臺(tái)和目的站臺(tái)不能為空!); else if (textbox1.text = ) message

12、box.show(起始站臺(tái)不能為空!); else if (textbox2.text = ) messagebox.show(目的站臺(tái)不能為空!); for (int i = 0; i = 0) for (int j = 0; j = 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) != ) path += aa.substring(0, 4) + 到 + ret(aa, cc) + 轉(zhuǎn) + cc.subs

13、tring(0, 4) + 到 + ret(cc, bb) + 轉(zhuǎn) + bb.substring(0, 4) + 到 + textbox2.text; if (path != ) textbox3.text = path; else textbox3.text = 轉(zhuǎn)兩次車(chē)不能到達(dá),請(qǐng)選擇打的!; private void button2_click(object sender, eventargs e) string bus = new string10; filestream fs = new filestream(c:documents and settingsadministrator

14、桌面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 = & textbox2.text = ) messagebox.show(起始站臺(tái)和目的站臺(tái)不能為空!); else if (textbox1.text = ) messagebo

15、x.show(起始站臺(tái)不能為空!); else if (textbox2.text = ) messagebox.show(目的站臺(tái)不能為空!); for (int i=0; i = 0) for (int j = 0; j = 0) if (ret(aa, bb) != ) path += aa.substring(0, 4) + 到 + ret(aa, bb) + 轉(zhuǎn) + bb.substring(0, 4) + 到 + textbox2.text; if (path != ) textbox3.text = path; else textbox3.text = 轉(zhuǎn)一次車(chē)不能到達(dá),請(qǐng)選擇查

16、詢(xún)2,查詢(xún)交通路線(xiàn)!; private void button4_click(object sender, eventargs e) filestream fs = new filestream(c:documents and settingsadministrator桌面busesbusmyfile.txt, filemode.open, fileaccess.readwrite); streamwriter sw = new streamwriter(fs); string bus = new string10; bus0 = #001,火車(chē)站,吉祥橋,勝利門(mén),五愛(ài)北路,梁溪大橋,運(yùn)河飯店

17、,開(kāi)源大橋,蠡橋,北橋,稻香新村,中橋,景亭苑,震澤新村,旺山路,蠡湖大橋,蠡湖公園,蠡湖廣場(chǎng),蠡園,寶界橋,寶界村,黿頭渚; bus1 = #002,梅園公交總站,梅園,開(kāi)原寺,大渲,公益路,榮巷,張巷,第九人民醫(yī)院,上里東,河埒口; bus2 = #003,梓旺新村,東方名苑,東北塘,錦旺苑,夏氏物流,東風(fēng)橋木材市場(chǎng),金龍紙品,向陽(yáng),廣豐,丁村; bus3 = #004,胡埭停車(chē)場(chǎng),胡埭路,錢(qián)胡路,張舍,劉塘村,文良路,歷村,洋溪橋,江南皮件廠(chǎng); bus4 = #005,無(wú)錫動(dòng)物園,西山,東山,江原醫(yī)院,無(wú)錫藝校,開(kāi)源寺,梅園,梅園公交總站; bus5 = #006,錢(qián)橋,楊樹(shù)岸,惠錢(qián)路,

18、惠泉花園,石門(mén)路,嚴(yán)家鵬,烈士陵園,鳳翔南路,惠暢里,惠山,龍光路,威孚公司,五愛(ài)廣場(chǎng),西門(mén),復(fù)興路; bus6 = #007,錫山醫(yī)院,錫滬路,市人力資源,長(zhǎng)慶路,東林書(shū)院,檢察院,三鳳橋,二院,朝陽(yáng)廣場(chǎng),文化宮,體育公園,健康橋,梁溪大橋; bus7 = #008,火車(chē)站,勝利門(mén),商業(yè)大廈,八百伴,解放東路,風(fēng)雷新村,金海里,敘康里,; bus8 = #009,河埒口,四院,青山灣,青山支路,錫惠公園,吟苑公園,五愛(ài)廣場(chǎng),五愛(ài)北路,勝利門(mén),吉祥橋,火車(chē)站; bus9 = #010,中橋,景亭苑,震澤新村,旺山路,蠡湖大橋,蠡湖公園,蠡湖廣場(chǎng),蠡園,寶界橋,寶界村,黿頭渚; for (int

19、 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 system.collections.generic;

20、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) string bus = new string10; file

21、stream 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 bus.length; i+) string aa = busi; string a1

22、 =aa.split(,); if ( a10= textbox1.text) textbox3.text = busi; break; else messagebox.show(輸入的線(xiàn)路不正確!); break; private void button2_click(object sender, eventargs e) form3 f = new form3(); f.show(); this.hide(); private void button3_click(object sender, eventargs e) application.exit(); private void bu

23、tton4_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+) busi = sr.readline(); sr.close(); fs

24、.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 settingsadministrator桌面busesbusmyfile.txt, filemode.create, fileaccess.readwrite); streamwriter sw = new streamwriter(

25、fst); for (int i = 0; i bus.length; i+) sw.writeline(busi); sw.close(); fst.close(); 詳細(xì)設(shè)計(jì):(1)設(shè)計(jì)說(shuō)明:當(dāng)打開(kāi)軟件時(shí)首先選擇所需功能,代碼如下: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 par

26、tial class form3 : form public form3() initializecomponent(); 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,

27、eventargs e) application.exit(); private void radiobutton1_checkedchanged(object sender, eventargs e) 當(dāng)選擇查詢(xún)時(shí),首先寫(xiě)入文件,然后分別有轉(zhuǎn)一次車(chē)查詢(xún)和轉(zhuǎn)兩次車(chē)查詢(xún),代碼如下:using system;using system.collections.generic;using system.componentmodel;using system.data;using system.drawing;using system.text;using system.windows.forms;us

28、ing 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 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(); if (busi = null) n+; sr.close(); fs.close(); if (+n = bus.length) messagebox.show(文件內(nèi)容為空,請(qǐng)按讀入文件按鈕!); else string path = ; if (textbox1.text = & textbox2.text

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶(hù)所有。
  • 3. 本站RAR壓縮包中若帶圖紙,網(wǎng)頁(yè)內(nèi)容里面會(huì)有圖紙預(yù)覽,若沒(méi)有圖紙預(yù)覽就沒(méi)有圖紙。
  • 4. 未經(jīng)權(quán)益所有人同意不得將文件中的內(nèi)容挪作商業(yè)或盈利用途。
  • 5. 人人文庫(kù)網(wǎng)僅提供信息存儲(chǔ)空間,僅對(duì)用戶(hù)上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶(hù)上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶(hù)因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

評(píng)論

0/150

提交評(píng)論