航空訂票系統(tǒng)論文-航空客運(yùn)訂票系統(tǒng)設(shè)計(jì)-航空訂票管理系統(tǒng)論文_第1頁(yè)
航空訂票系統(tǒng)論文-航空客運(yùn)訂票系統(tǒng)設(shè)計(jì)-航空訂票管理系統(tǒng)論文_第2頁(yè)
航空訂票系統(tǒng)論文-航空客運(yùn)訂票系統(tǒng)設(shè)計(jì)-航空訂票管理系統(tǒng)論文_第3頁(yè)
航空訂票系統(tǒng)論文-航空客運(yùn)訂票系統(tǒng)設(shè)計(jì)-航空訂票管理系統(tǒng)論文_第4頁(yè)
航空訂票系統(tǒng)論文-航空客運(yùn)訂票系統(tǒng)設(shè)計(jì)-航空訂票管理系統(tǒng)論文_第5頁(yè)
已閱讀5頁(yè),還剩93頁(yè)未讀 繼續(xù)免費(fèi)閱讀

下載本文檔

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

文檔簡(jiǎn)介

課程設(shè)計(jì)報(bào)告摘要PAGEI摘要航空定票系統(tǒng)是使用JAVA編程技術(shù)在MYEclipse6.0集成開(kāi)發(fā)環(huán)境下開(kāi)發(fā)的訂票系統(tǒng)。該系統(tǒng)實(shí)現(xiàn)了航班管理、訂票管理、退票管理以及查詢(xún)航班等功能。在航班管理中航空公司內(nèi)部管理員能在系統(tǒng)中完成添加航班或刪除航班、更新航班信息、查看數(shù)據(jù)庫(kù)等功能。乘客能夠在系統(tǒng)中完成查詢(xún)航班、訂票辦理和退票辦理等功能。乘客可以用多種方式來(lái)查詢(xún)航班信息,也可以根據(jù)實(shí)際需要來(lái)訂票(單程、往返、聯(lián)程)。系統(tǒng)還能將這些信息保存在數(shù)據(jù)庫(kù)中,并供航空公司內(nèi)部管理員隨時(shí)查詢(xún)。關(guān)鍵詞:航空定票系統(tǒng),JAVA,MYEclipse6.0,定票,退票P(pán)AGEIIAbstractTheaviationsettlesaticketsystemisuseaJAVAplaitdistance'stechniqueintegratedintheMYEclipse6.0developundertheenvironmentdevelopofbookasystem.Thatsystemcarriesoutaserviceamanagementandbooksamanagement,dishonorbillmanagementandsearchesaserviceetc.function.Theairlineinternalmanagingpersoncancompletetoaddaserviceordeleteaservice,renewaserviceinformationandlookintoadatabaseinthesystemintheservicethemanagementetc.function.Thepassengercancompleteasearchserviceandbookatickettocarryouttocarryoutwithdishonorbillinthesystemetc.function.Thepassengercansearchaserviceinformationwithvariousways,canalsobookaticketaccordingtotheeffectivedemand.(oneway,gobackandforth,allieddistance)Thesystemreturnsanabilitywillthesetheinformationkeepinthedatabase,andprovideanairlinetheinternalmanagingpersonsearchesatanytime.Keywords:Theaviationsettlesasystem,JAVA,MYEclipse6.0,settleaticket,dishonorbill課程設(shè)計(jì)報(bào)告第1章緒論P(yáng)AGEIII目錄摘要 IAbstract II第1章緒論 1第2章系統(tǒng)功能介紹 22.1系統(tǒng)功能總框圖 22.2本人模塊功能介紹 22.2.1航班管理功能介紹 22.2.2查詢(xún)航班功能介紹 22.2.3訂票辦理功能介紹 32.2.4退票辦理功能介紹 32.2.5連接數(shù)據(jù)庫(kù)介紹 32.3組內(nèi)任務(wù)分工 4第3章數(shù)據(jù)庫(kù)設(shè)計(jì) 5第4章系統(tǒng)功能實(shí)現(xiàn) 74.1航班管理功能實(shí)現(xiàn) 74.2查詢(xún)航班功能實(shí)現(xiàn) 274.3訂票辦理功能實(shí)現(xiàn) 454.4退票辦理功能實(shí)現(xiàn) 654.5連接數(shù)據(jù)庫(kù)實(shí)現(xiàn) 82結(jié)論 90致謝 91參考文獻(xiàn) 92-PAGE1-第1章緒論航空定票系統(tǒng)的總目標(biāo)是:在計(jì)算機(jī)網(wǎng)絡(luò),數(shù)據(jù)庫(kù)和先進(jìn)的開(kāi)發(fā)平臺(tái)上,利用現(xiàn)有的軟件,配置一定的硬件,開(kāi)發(fā)一個(gè)具有開(kāi)放體系結(jié)構(gòu)的、易擴(kuò)充的、易維護(hù)的、具有良好人機(jī)交互界面的航空定票系統(tǒng),實(shí)現(xiàn)旅行社的機(jī)票銷(xiāo)售的自動(dòng)化的計(jì)算機(jī)系統(tǒng),為企業(yè)的決策層提供準(zhǔn)確、精細(xì)、迅速的機(jī)票銷(xiāo)售信息。具體功能為各個(gè)旅行社把預(yù)定機(jī)票的旅客信息(姓名、身份證號(hào)碼(護(hù)照號(hào)碼)、旅行時(shí)間、旅行始發(fā)地和目的地)輸入到系統(tǒng)中,系統(tǒng)為旅客安排航班。當(dāng)旅客交付了預(yù)訂金后,系統(tǒng)打印出訂單和訂金給旅客,旅客在飛機(jī)起飛前憑訂單交款取票,系統(tǒng)核對(duì)無(wú)誤即打印出機(jī)票給旅客。此外旅行社為隨時(shí)掌握各個(gè)航班飛機(jī)的乘載情況,需要定期進(jìn)行統(tǒng)計(jì),以便適當(dāng)調(diào)整。同時(shí)還需完成旅客延誤了時(shí)間而沒(méi)登上飛機(jī)要求退票的處理。課程設(shè)計(jì)報(bào)告第2章系統(tǒng)功能介紹-PAGE4-第2章系統(tǒng)功能介紹2.1系統(tǒng)功能總框圖查詢(xún)航班查詢(xún)航班訂票辦理退票辦理普通查詢(xún)航空訂票系統(tǒng)航班管理聯(lián)系我們綜合查詢(xún)單程訂票往返訂票聯(lián)程訂票添加航班刪除航班看數(shù)據(jù)庫(kù)更新航班2.2本人模塊功能介紹2.2.1航班管理功能介紹此模塊是航班管理模塊,主要負(fù)責(zé)對(duì)航班的管理,可以對(duì)航班添加、刪除航班、對(duì)航班更新修改、還可以查看數(shù)據(jù)庫(kù)。輸入管理員賬號(hào)(0302)和密碼(0302)登錄到航班管理中,管理員可以輸入航班的基本信息來(lái)插入航班,如:航班號(hào)、班期等;管理系統(tǒng)支持三種刪除模式,可以按航班號(hào)、航線和按星期來(lái)刪除航班;如果航班有變動(dòng),可以按相應(yīng)的信息來(lái)更新修改航班信息;管理員可以輸入管理員賬號(hào)(0302)和密碼(0302)進(jìn)入數(shù)據(jù)庫(kù)來(lái)查看操作是否成功。2.2.2查詢(xún)航班功能介紹本模塊的主要功能是對(duì)航班的具體信息進(jìn)行查詢(xún),使乘客對(duì)每趟航班的情況有所了解,以達(dá)到讓旅客對(duì)自己的出行進(jìn)行更好的安排。查詢(xún)分為普通查詢(xún)與綜合查詢(xún),普通查詢(xún)分三種:按航班號(hào)查詢(xún)、按航空公司查詢(xún)和按到達(dá)目的地查詢(xún)。按航班號(hào)查詢(xún)可以讓乘客輸入指定的航班號(hào),查詢(xún)得到該航班號(hào)的具體起飛地點(diǎn)、起飛時(shí)間等信息;按航空公司查詢(xún)可得到屬于該航空公司的所有航班的信息;按到達(dá)目的地查詢(xún)分兩種情況,第一種直接選擇抵達(dá)的目的地,查詢(xún)得到的是所有到達(dá)該地點(diǎn)的航班信息;第二種在抵達(dá)目的地的基礎(chǔ)上多了個(gè)出發(fā)地點(diǎn),查詢(xún)得到的是所有從該出發(fā)地點(diǎn)起飛,到目的地的航班的信息。綜合查詢(xún)可以按乘客的需求進(jìn)行單程、往返、聯(lián)程的綜合查詢(xún)。單程查詢(xún)即讓乘客給出出發(fā)地點(diǎn)、到達(dá)地點(diǎn)和出發(fā)時(shí)間,查詢(xún)得到的是與出發(fā)時(shí)間最接近的航班的信息;往返查詢(xún)?cè)趩纬滩樵?xún)的基礎(chǔ)上多加個(gè)返程時(shí)間,查詢(xún)得到出發(fā)時(shí)間與返程時(shí)間最近的航班信息,使乘客對(duì)自己出發(fā)及返程時(shí)間有個(gè)了解;聯(lián)程查詢(xún)即在單程查詢(xún)的基礎(chǔ)上增加第二到達(dá)城市與第二到達(dá)城市的出發(fā)時(shí)間,使乘客在去兩個(gè)不同城市旅行時(shí)對(duì)第二旅行目的地的乘坐班次有所了解,以免影響乘客的旅行計(jì)劃。2.2.3訂票辦理功能介紹此模塊為訂票辦理模塊,程序運(yùn)行時(shí)會(huì)彈出一個(gè)主窗口包含“訂票辦理”,“退票辦理”,“航班查詢(xún)”,“航班管理”和“聯(lián)系我們”。當(dāng)你想訂票時(shí),點(diǎn)擊“訂票辦理”就會(huì)彈出“國(guó)內(nèi)機(jī)票實(shí)時(shí)速定”窗口,其中包含“第一出發(fā)日期”,“第一航班號(hào)”,“機(jī)票類(lèi)型”等菜單,還有兩個(gè)按鈕系統(tǒng):“機(jī)票預(yù)訂”和“返回主界面”。而且訂票時(shí)需要填寫(xiě)時(shí)間在“第一出發(fā)日期”中填寫(xiě),填寫(xiě)時(shí)一定要填寫(xiě)當(dāng)前日期之后的要不然會(huì)提示錯(cuò)誤。填寫(xiě)“航班號(hào)”時(shí)也不能出錯(cuò)。“機(jī)票類(lèi)型”主要包括:“單程”,“往返”和“聯(lián)票”每一項(xiàng)都有需要填寫(xiě)的不同的項(xiàng)。其中“往返”中多了“返回日期”和“返回航班”,“聯(lián)票”有“第二出發(fā)日期”和“第二航班號(hào)”需要填寫(xiě)。當(dāng)你填寫(xiě)號(hào)確定沒(méi)問(wèn)題時(shí)就可以點(diǎn)擊“機(jī)票預(yù)訂”按鈕,當(dāng)點(diǎn)擊后會(huì)彈出“客戶資料”在此窗口中需要填寫(xiě)“真實(shí)姓名”,“身份證號(hào)”,“聯(lián)系電話”等一系列項(xiàng)還可以留下“簡(jiǎn)短的附言”然后點(diǎn)進(jìn)“完成并提交”就可以定到你想要的機(jī)票了。如果填寫(xiě)錯(cuò)了還可以“重新輸入”或返回“實(shí)時(shí)訂票”系統(tǒng)重新預(yù)訂!2.2.4退票辦理功能介紹此模塊為退票辦理模塊(主界面中單機(jī)航空訂票系統(tǒng)的“退票辦理”),程序運(yùn)行時(shí)會(huì)彈出航班退票系統(tǒng)窗口,此時(shí)需要客戶輸入正確的相應(yīng)的訂單號(hào)與身份證號(hào)碼,當(dāng)你填寫(xiě)號(hào)碼確定沒(méi)問(wèn)題時(shí)就可以單擊“查詢(xún)”,即可查出此訂單的基本信息欄與退票欄。基本信息其中包含“客戶姓名”,“航班信息”,“兒童票數(shù)”,“成人票數(shù)”,“原票價(jià)”,“退票價(jià)”“出發(fā)時(shí)間”。當(dāng)您檢查無(wú)誤后,即可在退票欄中輸入想要退的兒童票數(shù)與成人票數(shù)的數(shù)量,當(dāng)確定無(wú)誤后,點(diǎn)擊“退票”就會(huì)彈出“退票成功”窗口,窗體中提示您已退票成功,還剩下多少?gòu)埰焙瞳@得多少元的退票錢(qián)。2.2.5連接數(shù)據(jù)庫(kù)介紹此模塊為連接數(shù)據(jù)庫(kù)模塊,對(duì)以上的操作對(duì)數(shù)據(jù)庫(kù)中的存儲(chǔ)各信息的表進(jìn)行操作具體的實(shí)施,如查詢(xún)功能中可按航班號(hào)查詢(xún)、按航空公司查詢(xún)和按到達(dá)目的地查詢(xún)對(duì)數(shù)據(jù)庫(kù)中航班查詢(xún)。查詢(xún)得到該航班號(hào)的具體起飛地點(diǎn)、起飛時(shí)間等信息,及所有航班的信息,地點(diǎn)的航班信息,到目的地的航班的等多個(gè)信息。連接數(shù)據(jù)庫(kù)進(jìn)行表查詢(xún)。訂票時(shí),可通過(guò)訂票辦理、國(guó)內(nèi)機(jī)票實(shí)時(shí)速定、機(jī)票類(lèi)型等多種信息,向數(shù)據(jù)庫(kù)表中添加訂票信息。退票辦理模塊,首先查找用戶數(shù)據(jù)庫(kù)中表信息,然后為用戶退還機(jī)票及退票錢(qián)刪除表中用戶信息。航班管理中,管理員可通過(guò)各種信息來(lái)插入、刪除、更改航班信息,進(jìn)入數(shù)據(jù)庫(kù)來(lái)查看操作是否成功。2.3組內(nèi)任務(wù)分工姓名主要工作組長(zhǎng)總體構(gòu)思、航班管理模塊、報(bào)告撰寫(xiě)組員訂票辦理模塊、報(bào)告撰寫(xiě)航班查詢(xún)模塊、報(bào)告撰寫(xiě)連接數(shù)據(jù)庫(kù)模塊、報(bào)告撰寫(xiě)界面設(shè)計(jì)、退票辦理模塊、報(bào)告撰寫(xiě)課程設(shè)計(jì)報(bào)告第3章數(shù)據(jù)庫(kù)設(shè)計(jì)-PAGE6-第3章數(shù)據(jù)庫(kù)設(shè)計(jì)數(shù)據(jù)庫(kù)的設(shè)計(jì)就是數(shù)據(jù)庫(kù)及其應(yīng)用系統(tǒng)的設(shè)計(jì),換句話說(shuō)就是設(shè)計(jì)整個(gè)的數(shù)據(jù)庫(kù)應(yīng)用系統(tǒng)。從狹義的角度來(lái)講,就是設(shè)計(jì)數(shù)據(jù)本身,也就是設(shè)計(jì)數(shù)據(jù)庫(kù)的各級(jí)模式并建立數(shù)據(jù)庫(kù),這是數(shù)據(jù)庫(kù)應(yīng)用系統(tǒng)設(shè)計(jì)的一部分。設(shè)計(jì)一個(gè)好的數(shù)據(jù)庫(kù)與設(shè)計(jì)一個(gè)好的數(shù)據(jù)庫(kù)應(yīng)用系統(tǒng)是密不可分的。一個(gè)好的數(shù)據(jù)庫(kù)結(jié)構(gòu)是應(yīng)用系統(tǒng)的基礎(chǔ)。特別在實(shí)際的系統(tǒng)開(kāi)發(fā)項(xiàng)目中兩者更是密切相關(guān)、并行進(jìn)行的。數(shù)據(jù)庫(kù)設(shè)計(jì)的目標(biāo)是為用戶和各種應(yīng)用系統(tǒng)提供一個(gè)信息基礎(chǔ)設(shè)施和高效率的運(yùn)行環(huán)境。高效率的運(yùn)行環(huán)境包括:數(shù)據(jù)庫(kù)數(shù)據(jù)的存取效率、數(shù)據(jù)庫(kù)存儲(chǔ)空間的利用率、數(shù)據(jù)庫(kù)系統(tǒng)運(yùn)行管理的效率等都是高的。3.1數(shù)據(jù)庫(kù)需求分析通過(guò)到旅行社進(jìn)行實(shí)地考察,我們小組了解了航空訂票系統(tǒng)的具體功能。由于航空訂票系統(tǒng)是各個(gè)旅行社必不可少的工具,所以我們小組認(rèn)為開(kāi)發(fā)本系統(tǒng)是有一定價(jià)值的。通過(guò)考察后,我們小組對(duì)航空訂票系統(tǒng)進(jìn)行分析并做出了如下的功能:查詢(xún)航班功能、訂票辦理功能、退票辦理功能、航班管理功能。其中航班管理中主要實(shí)現(xiàn)添加航班、刪除航班、更新航班和查看數(shù)據(jù)庫(kù)功能。3.2數(shù)據(jù)庫(kù)概念結(jié)構(gòu)設(shè)計(jì)leaveTimestartleaveTimestartairfirmairfirmarriveTimearriveTimearriveTimearriveTimeflightflightflightflightchildFarechildFareadultFareremarkadultFareremarkdiscount1weekdiscount1weekdiscount2seatdiscount2seatdestinationdestination3.3數(shù)據(jù)庫(kù)表的設(shè)計(jì)數(shù)據(jù)庫(kù)設(shè)計(jì)其實(shí)就是表的設(shè)計(jì),該系統(tǒng)中主要涉及到了一個(gè)表,其主要結(jié)構(gòu)及內(nèi)容如下:表31flight信息表字段名稱(chēng)數(shù)據(jù)類(lèi)型長(zhǎng)度備注flight文本10航班號(hào)airfirm文本20航空公司start文本10起始城市destination文本10降落城市l(wèi)eaveTime文本10離開(kāi)時(shí)間arriveTime文本10到達(dá)時(shí)間childFare數(shù)字單精度型兒童票價(jià)adultFare數(shù)字單精度型成人票價(jià)discount1數(shù)字單精度型提前折扣discount2數(shù)字單精度型退票率seat數(shù)字整型坐位week文本10星期remark數(shù)字整型插入號(hào)課程設(shè)計(jì)報(bào)告第4章系統(tǒng)功能實(shí)現(xiàn)-PAGE89-第4章系統(tǒng)功能實(shí)現(xiàn)4.1航班管理功能實(shí)現(xiàn)先輸入管理員賬號(hào)(0302)和密碼(0302)進(jìn)入到航班管理中,登陸如圖4.1.1和如圖4.1.2所示。圖4.1.1賬號(hào)驗(yàn)證界面圖4.1.2密碼驗(yàn)證界面管理員可以輸入航班的基本信息來(lái)插入航班,如:航班號(hào)、班期等。插入班期時(shí)形式如1357;插入界面如圖4.1.3所示。圖4.1.3插入界面航班刪除支持三種刪除模式,可以按航班號(hào)、航線和按星期來(lái)刪除航班,在刪除航班時(shí),首先得選擇一種模式,才可以進(jìn)行刪除,在刪除時(shí),得從下拉列表中選擇要?jiǎng)h除的航班,才可以刪除;刪除界面如圖4.1.4所示圖4.1.4插入界面在更新航班時(shí),可以選中要更新項(xiàng)前面的方框,即可激活更新區(qū)域,輸入新值,點(diǎn)擊確定即可更新航班信息;更新界面如圖4.1.5所示圖4.1.5更新界面管理員可以輸入管理員賬號(hào)(0302)和密碼(0302)進(jìn)入數(shù)據(jù)庫(kù)來(lái)查看操作是否成功。查看數(shù)據(jù)庫(kù)界面如圖4.1.6所示。圖4.1.6查看數(shù)據(jù)庫(kù)界面程序代碼如下://插入功能publicInsertPanel() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(Exceptionex) { } week=newJComboBox(); for(inti=0;i<s.length;i++) week.addItem(s[i]); hour1=newJComboBox(); hour2=newJComboBox(); min1=newJComboBox(); min2=newJComboBox(); for(inti=1;i<=24;i++) { if(i<10) { hour1.addItem(""+0+i); hour2.addItem(""+0+i); } else { hour1.addItem(""+i); hour2.addItem(""+i); } } for(inti=0;i<=59;i++) { if(i<10) { min1.addItem(""+0+i); min2.addItem(""+0+i); } else { min1.addItem(""+i); min2.addItem(""+i); } } JPanelp3=newJPanel(); p3.add(hour1); p3.add(newJLabel("時(shí)")); p3.add(min1); p3.add(newJLabel("分")); JPanelp4=newJPanel(); p4.add(hour2); p4.add(newJLabel("時(shí)")); p4.add(min2); p4.add(newJLabel("分")); JPanelp1=newJPanel(); p1.setBorder(newTitledBorder("基本信息")); p1.setLayout(newGridLayout(6,4,5,5)); p1.add(label[0]=newJLabel("航班號(hào)")); p1.add(jtf[0]=newJTextField(10)); p1.add(label[1]=newJLabel("班期")); p1.add(jtf[1]=newJTextField(10)); p1.add(label[0]=newJLabel("公司")); p1.add(jtf[2]=newJTextField(10)); p1.add(label[0]=newJLabel("座位")); p1.add(jtf[3]=newJTextField(10)); p1.add(label[0]=newJLabel("起飛地")); p1.add(jtf[4]=newJTextField(10)); p1.add(label[0]=newJLabel("抵達(dá)地")); p1.add(jtf[5]=newJTextField(10)); p1.add(label[0]=newJLabel("起飛時(shí)間")); p1.add(p3);// p1.add(jtf[6]=newJTextField(10)); p1.add(label[0]=newJLabel("抵達(dá)時(shí)間")); p1.add(p4);// p1.add(jtf[7]=newJTextField(10)); p1.add(label[0]=newJLabel("兒童票價(jià)")); p1.add(jtf[8]=newJTextField(10)); p1.add(label[0]=newJLabel("成人票價(jià)")); p1.add(jtf[9]=newJTextField(10)); p1.add(label[0]=newJLabel("提前折扣")); p1.add(jtf[10]=newJTextField(10)); p1.add(label[0]=newJLabel("退票率")); p1.add(jtf[11]=newJTextField(10)); JPanelp2=newJPanel(); p2.setBorder(newTitledBorder("操作")); p2.add(button[0]=newJButton("插入"));// p2.add(button[1]=newJButton("刪除"));// p2.add(button[2]=newJButton("更新")); this.setLayout(newBorderLayout()); this.add(p1,BorderLayout.CENTER); this.add(p2,BorderLayout.SOUTH); button[0].addActionListener(newActionListener() { publicvoidactionPerformed(ActionEvente) { try { con=DriverManager.getConnection("jdbc:odbc:dsStudent","sa",""); stmt=con.createStatement(); if(jtf[0].getText().length()==0) { JOptionPane.showMessageDialog(null,"關(guān)鍵字不能為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); return; } if(jtf[2].getText().length()==0) { JOptionPane.showMessageDialog(null,"公司為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); return; } if(jtf[3].getText().length()==0) { JOptionPane.showMessageDialog(null,"作為書(shū)惟恐","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); return; } if(jtf[4].getText().length()==0) { JOptionPane.showMessageDialog(null,"城市為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); return; } if(jtf[5].getText().length()==0) { JOptionPane.showMessageDialog(null,"城市為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); return; } if(jtf[8].getText().length()==0) { JOptionPane.showMessageDialog(null,"信息不能為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); return; } if(jtf[9].getText().length()==0) { JOptionPane.showMessageDialog(null,"信息不能為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); return; } if(jtf[10].getText().length()==0) { JOptionPane.showMessageDialog(null,"信息不能為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); return; } if(jtf[11].getText().length()==0) { JOptionPane.showMessageDialog(null,"信息不能為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); return; } else { intmaxremark=1; System.out.print("hello2"); rs=stmt.executeQuery("selectremarkfromflight");System.out.print("hello1"); intremark=0; while(rs.next()) { System.out.print(maxremark); remark=rs.getInt(1); if(remark>maxremark)maxremark=remark; } System.out.print(maxremark); Stringtime1=(String)hour1.getSelectedItem()+(String)min1.getSelectedItem(); Stringtime2=(String)hour2.getSelectedItem()+(String)min2.getSelectedItem();maxremark=maxremark+1; Stringsql="insertintoflightvalues('"+jtf[0].getText()+"','"+jtf[2].getText()+"','"+ jtf[4].getText()+"','"+jtf[5].getText()+"','"+time1+"','"+ time2+"',"+Float.parseFloat(jtf[8].getText().trim())+","+Float.parseFloat(jtf[9].getText().trim())+"," +Float.parseFloat(jtf[10].getText().trim())+","+Float.parseFloat(jtf[11].getText().trim())+","+Integer.parseInt(jtf[3].getText().trim()) +",'"+jtf[1].getText()+"',"+maxremark+")"; stmt.executeUpdate(sql); System.out.print("he"); stmt.close(); con.close(); }} catch(Exceptionex) { ex.printStackTrace(); } } }); }//刪除功能publicDeletePanel() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(Exceptionex) { } radio1=newJRadioButton("按航班號(hào)進(jìn)行"); radio2=newJRadioButton("按星期進(jìn)行"); radio3=newJRadioButton("按起止城市"); group.add(radio1); group.add(radio2); group.add(radio3); JPanelp9=newJPanel(newFlowLayout(FlowLayout.LEFT)); p9.add(flight1); JPaneljp1=newJPanel(newBorderLayout()); jp1.add(newJLabel(""),BorderLayout.WEST); jp1.add(radio1,BorderLayout.CENTER); jp1.add(newJLabel(""),BorderLayout.EAST); JPanelp1=newJPanel(); p1.setBorder(newTitledBorder("航班號(hào)")); p1.setLayout(newBorderLayout()); p1.add(jp1,BorderLayout.WEST); p1.add(p9,BorderLayout.CENTER); JPanelp6=newJPanel(newFlowLayout(FlowLayout.LEFT)); p6.add(flight2); p6.add(newJLabel("")); p6.add(week); JPaneljp2=newJPanel(newBorderLayout()); jp2.add(newJLabel(""),BorderLayout.WEST); jp2.add(radio2,BorderLayout.CENTER); jp2.add(newJLabel(""),BorderLayout.EAST); JPanelp2=newJPanel(); p2.setBorder(newTitledBorder("星期")); p2.setLayout(newBorderLayout()); p2.add(jp2,BorderLayout.WEST); p2.add(p6,BorderLayout.CENTER);JPanelp11=newJPanel(newFlowLayout(FlowLayout.LEFT));p11.add(start);p11.add(newJLabel(""));p11.add(city1);JPanelp12=newJPanel(newFlowLayout(FlowLayout.LEFT));p12.add(end);p12.add(newJLabel(""));p12.add(city2); JPanelp3=newJPanel(); p3.setLayout(newGridLayout(2,1)); p3.add(p11); p3.add(p12); JPaneljp3=newJPanel(newFlowLayout(FlowLayout.CENTER)); jp3.add(newJLabel(""),BorderLayout.WEST); jp3.add(radio3,BorderLayout.CENTER); jp3.add(newJLabel(""),BorderLayout.EAST); JPanelp4=newJPanel(); p4.setBorder(newTitledBorder("航線")); p4.setLayout(newBorderLayout()); p4.add(jp3,BorderLayout.WEST); p4.add(p3,BorderLayout.CENTER); JPanelp5=newJPanel(); p5.setLayout(newBorderLayout()); p5.add(p1,BorderLayout.NORTH); p5.add(p4,BorderLayout.CENTER); p5.add(p2,BorderLayout.SOUTH); JPanelp7=newJPanel(); p7.setBorder(newTitledBorder("操作")); p7.add(ok); this.setLayout(newBorderLayout()); this.add(label,BorderLayout.NORTH); this.add(p5,BorderLayout.CENTER); this.add(p7,BorderLayout.SOUTH); flight2.addActionListener(newActionListener() { publicvoidactionPerformed(ActionEvente) { try { con=DriverManager.getConnection("jdbc:odbc:dsStudent","sa",""); stmt=con.createStatement(); Stringflight=(String)flight2.getSelectedItem(); rs=stmt.executeQuery("selectweekfromflightwhereflight='"+flight+"'"); while(rs.next()) { w=rs.getString(1).trim(); } for(inti=0;i<=w.length();i++) { charc=w.charAt(i); Strings=""+c; week.addItem(s); } } catch(Exceptionex) { } } }); ok.addActionListener(this); } publicstaticvoidupdateCityComboBox(StringnewCity,intflag) { if(flag==1) { if(modelCity.getIndexOf(newCity)==-1) { modelCity.addElement(newCity); city1.addItem(newCity); city2.addItem(newCity); } } if(flag==2) { if(modelCity.getIndexOf(newCity)!=-1) { modelCity.removeElement(newCity); city1.removeItem(newCity); city1.removeItem(newCity); } } } publicstaticvoidupdateFlightComboBox(StringnewFlight,intflag) { if(flag==1) { if(modelFlight.getIndexOf(newFlight)==-1) { modelFlight.addElement(newFlight); flight1.addItem(newFlight); flight2.addItem(newFlight); } } if(flag==2) { if(modelFlight.getIndexOf(newFlight)!=-1) { modelFlight.removeElement(newFlight); flight1.removeItem(newFlight); flight2.removeItem(newFlight); } } } //繼承ActionListener接口publicvoidactionPerformed(ActionEvente) { try { con=DriverManager.getConnection("jdbc:odbc:dsStudent","sa",""); stmt=con.createStatement(); if(e.getSource()instanceofJButton) { if(radio1.isSelected()) { Stringflight=(String)flight1.getSelectedItem(); Stringsql="deletefromflightwhereflight='"+flight+"'"; stmt.executeUpdate(sql); } elseif(radio3.isSelected()) { Stringstart=(String)city1.getSelectedItem(); Stringdestination=(String)city2.getSelectedItem();Stringsql="deletefromflightwherestart='"+start+"'anddestination='"+destination+"'";stmt.executeUpdate(sql); } elseif(radio2.isSelected()) { Stringflight=(String)flight2.getSelectedItem(); rs=stmt.executeQuery("selectweekfromflightwhereflight='"+flight+"'"); while(rs.next()) { w=rs.getString(1).trim(); } for(inti=0;i<=w.length();i++) { charc=w.charAt(i); Strings=""+c; if(week.getSelectedItem().equals(s)) { k=i;break; } } Stringweek=w.substring(0,k)+w.substring(k+1,w.length()); System.out.println(week.length()); if(week.length()==0) stmt.executeUpdate("deletefromflightwhereflight='"+flight+"'"); elsestmt.executeUpdate("updateflightsetweek='"+week+"'whereflight='"+flight+"'"); } elseJOptionPane.showMessageDialog(this,"你沒(méi)有選擇三種情況之一","選擇",JOptionPane.ERROR_MESSAGE); } } catch(Exceptionex) { } }//更新功能publicUpdatePanel() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(Exceptionex) { } JPanelp1=newJPanel(); p1.setBorder(newTitledBorder("基本信息")); p1.setLayout(newGridLayout(6,4,5,5)); p1.add(radio[0]=newJCheckBox("航班號(hào)")); p1.add(jtf[0]=newJTextField(10)); p1.add(radio[1]=newJCheckBox("星期")); p1.add(jtf[1]=newJTextField(10)); p1.add(radio[2]=newJCheckBox("公司")); p1.add(jtf[2]=newJTextField(10)); p1.add(radio[3]=newJCheckBox("座位")); p1.add(jtf[3]=newJTextField(10)); p1.add(radio[4]=newJCheckBox("起飛地")); p1.add(jtf[4]=newJTextField(10)); p1.add(radio[5]=newJCheckBox("抵達(dá)地")); p1.add(jtf[5]=newJTextField(10)); p1.add(radio[6]=newJCheckBox("起飛時(shí)間")); p1.add(jtf[6]=newJTextField(10)); p1.add(radio[7]=newJCheckBox("抵達(dá)時(shí)間")); p1.add(jtf[7]=newJTextField(10)); p1.add(radio[8]=newJCheckBox("兒童票價(jià)")); p1.add(jtf[8]=newJTextField(10)); p1.add(radio[9]=newJCheckBox("成人票價(jià)")); p1.add(jtf[9]=newJTextField(10)); p1.add(radio[10]=newJCheckBox("提前折扣")); p1.add(jtf[10]=newJTextField(10)); p1.add(radio[11]=newJCheckBox("退票率")); p1.add(jtf[11]=newJTextField(10)); JPanelp2=newJPanel(); p2.setBorder(newTitledBorder("操作")); p2.add(button); this.setLayout(newBorderLayout()); this.add(p1,BorderLayout.CENTER); this.add(p2,BorderLayout.SOUTH); for(inti=0;i<=11;i++) jtf[i].setEditable(false); for(inti=0;i<=11;i++) radio[i].addItemListener(this); button.addActionListener(this); } publicvoiditemStateChanged(ItemEvente) { if(e.getSource()instanceofJCheckBox) { if(radio[1].isSelected()&&flag==1) {JOptionPane.showMessageDialog(null,"輸入格式如135","暗示",JOptionPane.WARNING_MESSAGE);flag=0;} for(inti=0;i<=11;i++) if(radio[i].isSelected())jtf[i].setEditable(true); for(inti=0;i<=11;i++) if(!radio[i].isSelected())jtf[i].setEditable(false); } } publicvoidactionPerformed(ActionEvente) { try { Stringsql=""; con=DriverManager.getConnection("jdbc:odbc:dsStudent","sa",""); stmt=con.createStatement(); if(e.getSource()instanceofJButton) { if(!radio[0].isSelected()||(radio[0].isSelected()&&jtf[0].getText().length()==0)) JOptionPane.showMessageDialog(null,"關(guān)鍵字不能為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); else { for(inti=2;i<=11;i++) if(radio[i].isSelected()&&jtf[i].getText().length()==0) { tag=true;break; } if(tag) { JOptionPane.showMessageDialog(null,"信息不能為空","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); tag=false; } else { StringsqlString="selectflightfromflightwhereflight='"+jtf[0].getText().trim()+"'"; ResultSetrs=stmt.executeQuery(sqlString); intflag1=0; while(rs.next()) { flag1=1; } if(flag1==0) { JOptionPane.showMessageDialog(null,"對(duì)不起!航班號(hào)不存在!", "錯(cuò)誤信息",JOptionPane.ERROR_MESSAGE); return; } System.out.println(flag1); if(radio[2].isSelected()) { sql="updateflightsetairFirm='"+jtf[2].getText()+"'whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } if(radio[3].isSelected()) { sql="updateflightsetseat="+Integer.parseInt(jtf[3].getText().trim())+"whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } if(radio[4].isSelected()) { sql="updateflightsetstart='"+jtf[4].getText()+"'whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } if(radio[5].isSelected()) { sql="updateflightsetdestination='"+jtf[5].getText()+"'whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } if(radio[6].isSelected()) { sql="updateflightsetleaveTime='"+jtf[6].getText()+"'whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } if(radio[7].isSelected()) { sql="updateflightsetarriveTime='"+jtf[7].getText()+"'whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } if(radio[8].isSelected()) { sql="updateflightsetchildFare="+Float.parseFloat(jtf[8].getText().trim())+"whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } if(radio[9].isSelected()) { sql="updateflightsetadultFare="+Float.parseFloat(jtf[9].getText().trim())+"whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } if(radio[10].isSelected()) { sql="updateflightsetdiscount1="+Float.parseFloat(jtf[10].getText().trim())+"whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } if(radio[11].isSelected()) { sql="updateflightsetdiscount2="+Float.parseFloat(jtf[11].getText().trim())+"whereflight='"+jtf[0].getText()+"'"; stmt.executeUpdate(sql); } JOptionPane.showMessageDialog(null,"航班信息已經(jīng)更新成功!", "成功信息",JOptionPane.INFORMATION_MESSAGE); } } } } catch(Exceptionex) { } }//查看數(shù)據(jù)庫(kù)publicShow() { try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); } catch(Exceptionex) { } pan=newJScrollPane(area); JPanelp1=newJPanel(); p1.setBorder(newTitledBorder("輸入有效認(rèn)證")); p1.add(label1); p1.add(jtf); p1.add(label2); p1.add(password); JPanelp2=newJPanel(); p2.setBorder(newTitledBorder("操作")); p2.add(button); this.setLayout(newBorderLayout()); this.add(p1,BorderLayout.NORTH); this.add(pan,BorderLayout.CENTER); this.add(p2,BorderLayout.SOUTH); button.addActionListener(this); } publicvoidactionPerformed(ActionEvente) { try { area.setText(""); if(!(jtf.getText().equals("0302")&&password.getText().equals("0302"))) JOptionPane.showMessageDialog(null,"賬好或密碼不對(duì)","錯(cuò)誤",JOptionPane.ERROR_MESSAGE); else {con=DriverManager.getConnection("jdbc:odbc:dsStudent","sa",""); stmt=con.createStatement(); rs=stmt.executeQuery("select*fromflight"); while(rs.next()) { area.append(rs.getString(1)); area.append(rs.getString(2)); area.append(rs.getString(3)); area.append(rs.getString(4)); area.append(rs.getString(5)); area.append(rs.getString(6)); area.append(""+rs.getFloat(7)+""); area.append(""+rs.getFloat(8)+""); area.append(""+rs.getFloat(9)+""); area.append(""+rs.getFloat(10)+""); area.append(""+rs.getInt(11)+""); area.append(rs.getString(12)); area.append(rs.getString(13)+"\n"); }}} catch(Exceptionex) { } }4.2查詢(xún)航班功能實(shí)現(xiàn)查詢(xún)航班分為普通查詢(xún)與綜合查詢(xún)。普通查詢(xún)?nèi)鐖D4.2.1所示。圖4.2.1普通查詢(xún)界面 通過(guò)普通查詢(xún)可得到乘客想要得知的航班信息,普通查詢(xún)得到信息如圖4.2.2所示。圖4.2.2查詢(xún)信息界面綜合查詢(xún)?nèi)鐖D4.2.3所示圖4.2.3綜合查詢(xún)界面 綜合查詢(xún)可得知乘客想要乘坐的最近的航班出發(fā)日期,并可對(duì)單程、往返、聯(lián)程3種乘坐方式進(jìn)行查詢(xún)。得到的查詢(xún)信息界面如圖4.2.4所示。圖4.2.4綜合查詢(xún)信息界面程序代碼如下:publicstaticvoidupdateAirFirmComboBox(StringnewAirFirm,intinsertOrDelete){ if(insertOrDelete==1) { if(modelAirFirm.getIndexOf(newAirFirm)==-1) jcbAirFirm.addItem(newAirFirm); } elseif(insertOrDelete==2) { if(modelAirFirm.getIndexOf(newAirFirm)!=-1) jcbAirFirm.removeItem(newAirFirm); } }publicvoidsetDisplayPresentTime(){ Calendarcal=Calendar.getInstance(); //獲得年月日 Stringyear=String.valueOf(cal.get(Calendar.YEAR)); Stringmonth=String.valueOf(cal.get(Calendar.MONTH)+1); Stringday=String.valueOf(cal.get(Calendar.DAY_OF_MONTH)); //顯示時(shí)間 jcbYear1.setSelectedItem(year); jcbYear2.setSelectedItem(year); jcbMonth1.setSelectedItem(month); jcbMonth2.setSelectedItem(month); //更新年月 updateDay(year,month,jcbDay1); updateDay(year,month,jcbDay2); jcbDay1.setSelectedItem(day); jcbDay2.setSelectedItem(day); }//更新天privatevoidupdateDay(Stringyear,Stringmonth,JComboBoxjcb){ //有30天的月是4,6,9,11月 if(month.equals("4")||month.equals("6")||month.equals("9")||month.equals("11")) { //jcb.getItemCount()==31meansthatthereare31daysinthedaycombobox, //butexactlyitis30days,soweshouldremovethe31stdayfromthedaycombobox if(jcb.getItemCount()==31) jcb.removeItem("31"); elseif(jcb.getItemCount()==29) jcb.addItem("30"); elseif(jcb.getItemCount()==28) { jcb.addItem("29"); jcb.addItem("30"); } } //在2月份有28或29天 elseif(month.equals("2")) { intyears=Integer.parseInt(year); //閏年 if((years%400==0)||(years%4==0&&years%100!=0)) { if(jcb.getItemCount()==31) { jcb.removeItem("30"); jcb.removeItem("31"); } elseif(jcb.getItemCount()==30) { jcb.removeItem("30"); } elseif(jcb.getItemCount()==28) { jcb.addItem("29"); } } //不是閏年 else { if(jcb.getItemCount()==29) { jcb.removeItem("29"); } elseif(jcb.getItemCount()==30) { jcb.removeItem("29");

溫馨提示

  • 1. 本站所有資源如無(wú)特殊說(shuō)明,都需要本地電腦安裝OFFICE2007和PDF閱讀器。圖紙軟件為CAD,CAXA,PROE,UG,SolidWorks等.壓縮文件請(qǐng)下載最新的WinRAR軟件解壓。
  • 2. 本站的文檔不包含任何第三方提供的附件圖紙等,如果需要附件,請(qǐng)聯(lián)系上傳者。文件的所有權(quán)益歸上傳用戶所有。
  • 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ì)用戶上傳內(nèi)容的表現(xiàn)方式做保護(hù)處理,對(duì)用戶上傳分享的文檔內(nèi)容本身不做任何修改或編輯,并不能對(duì)任何下載內(nèi)容負(fù)責(zé)。
  • 6. 下載文件中如有侵權(quán)或不適當(dāng)內(nèi)容,請(qǐng)與我們聯(lián)系,我們立即糾正。
  • 7. 本站不保證下載資源的準(zhǔn)確性、安全性和完整性, 同時(shí)也不承擔(dān)用戶因使用這些下載資源對(duì)自己和他人造成任何形式的傷害或損失。

最新文檔

評(píng)論

0/150

提交評(píng)論