日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問(wèn) 生活随笔!

生活随笔

當(dāng)前位置: 首頁(yè) > 运维知识 > windows >内容正文

windows

数据结构课设之航空订票系统(Java)下载链接在文末

發(fā)布時(shí)間:2023/12/10 windows 43 豆豆
生活随笔 收集整理的這篇文章主要介紹了 数据结构课设之航空订票系统(Java)下载链接在文末 小編覺(jué)得挺不錯(cuò)的,現(xiàn)在分享給大家,幫大家做個(gè)參考.

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?下載鏈接在文末

題目選擇 :航空訂票系統(tǒng)

開(kāi)發(fā)語(yǔ)言 :Java

代碼編寫(xiě)工具: Eclipse

與數(shù)據(jù)結(jié)構(gòu)相關(guān)知識(shí):隊(duì)列,棧,KMP匹配算法。

一、設(shè)計(jì)思路:

? ? ?1,首先在項(xiàng)目工程中創(chuàng)建Main Frame.java作為主窗口文件,設(shè)置窗口大小為,主題樣式,標(biāo)題欄,窗口圖標(biāo),并添加到當(dāng)前窗口中背景以及窗口可見(jiàn)性,之后創(chuàng)建InitGlobalFont方法,該方法設(shè)置全局字體的樣式和大小。

? ? ?2,之后在項(xiàng)目工程中創(chuàng)建MainPanel. Java文件,該文件用于切換界面,首先在該文件中定義一個(gè)jpanel,設(shè)置為卡片布局,之后將其添加到MainFrame中。

? ? ?3,在項(xiàng)目工程中創(chuàng)建FunctionPanel.java類(lèi),并將其添加到MainPanel.java的CardLayout中,并通過(guò)CardLayout.Show方法設(shè)置FunctionPanel為默認(rèn)顯示。在FunctionPanel.java中,創(chuàng)建三個(gè)圖片按鈕,,分別代表航班管理,訂票,退票,以及一個(gè)退出按鈕,并將它們添加點(diǎn)擊事件。

? ? 4,在項(xiàng)目工程中創(chuàng)建FunctionPanel.java文件,創(chuàng)建data文件夾,在該文件夾內(nèi)創(chuàng)建program-icon和program-store文件夾,分別用于存放圖標(biāo)和數(shù)據(jù),在program-store文件夾中創(chuàng)建flight.txt文件,寫(xiě)入所有的航班信息,每一行代表一個(gè)航班信息。

? ?5,FunctionPanel.java為航班管理界面,在該文件中,首先創(chuàng)建一個(gè)表格table,逐行讀取flight.txt的所有信息,將其存入隊(duì)列中,再?gòu)年?duì)列彈出將其添加到表格中。創(chuàng)建五個(gè)按鈕,分別為“添加航班”,“刪除航班”,“修改航班”,“刷新”,“返回”,以及一個(gè)文本框和搜索按鈕。

  • 點(diǎn)擊“添加航班”,將彈出添加窗口,在窗口中輸入航班信息,點(diǎn)擊確定即可將該信息添加到flight.txt文件中,并刷新表格。
  • 選中某表格中的某一條信息,點(diǎn)擊“刪除航班”,將會(huì)獲取該行中的航班號(hào),根據(jù)該航班號(hào)與flight.txt文件進(jìn)行逐行匹配,匹配成功則將其刪除,并刷新表格。
  • 選中某一條信息 點(diǎn)擊“修改航班”,過(guò)程與刪除航班類(lèi)似,匹配成功后對(duì)該行覆蓋寫(xiě)入,并刷新表格。
  • 點(diǎn)擊“刷新”,會(huì)重新讀取文件,將其顯示在表格中。
  • 點(diǎn)擊“返回”,會(huì)使MainPanel的CardLayout顯示FunctionPanel,即主界面。
  • 在文本框中輸入關(guān)鍵詞,點(diǎn)擊“搜索”按鈕,會(huì)將從文本框獲取的數(shù)據(jù)與flight.txt進(jìn)行逐行匹配,將匹配成功的信息存入隊(duì)列中,之后將隊(duì)列中的信息輸出在表格中。

? ?6,在項(xiàng)目工程中創(chuàng)建addPanel.java,作為航班訂票界面,在該界面中創(chuàng)建一個(gè)表格,以及三個(gè)按鈕,分別為“訂票”,“候補(bǔ)乘客”,“返回”,在data/ program-store文件夾中創(chuàng)建book-list.txt,用于存儲(chǔ)訂單,創(chuàng)建candidata-list.txt文件,用于存儲(chǔ)候補(bǔ)乘客。表格中顯示當(dāng)前所有航班,點(diǎn)擊某一條信息,點(diǎn)擊“訂票”,輸入乘客信息,數(shù)量,如果剩余票充足,則將當(dāng)前的航班號(hào),乘客信息,數(shù)量寫(xiě)入到book-list.txt文件中,并修改light.txt文件的該航班剩余票數(shù)。若余票不足,則提示是否列入候該航線(xiàn)的候補(bǔ)名單中。選中某一條航班,點(diǎn)擊“候補(bǔ)乘客”,則會(huì)讀取candidate-list.txt文件,并彈出新窗口以表格的形式顯示。點(diǎn)擊“返回”,則返回到主界面,點(diǎn)擊“搜索”,則會(huì)根據(jù)輸入的關(guān)鍵字和日期與flight.txt中的航班信息進(jìn)行匹配,將所有匹配成功的信息存入隊(duì)列中,清空表格,之后將隊(duì)列中的信息輸出在表格中,并以時(shí)間先后排序。

? ?7,在項(xiàng)目工程中創(chuàng)建deletePanel.java,作為航班退票界面,在該界面中創(chuàng)建一個(gè)表格,,以及三個(gè)按鈕,分別為“退票”,“候補(bǔ)乘客”,“返回”,以及一個(gè)文本框和“搜索”按鈕,表格中顯示當(dāng)前所有訂單,選中某一條訂單,點(diǎn)擊“退票”,則會(huì)根據(jù)航班號(hào)與book-list.txt文件里航班號(hào)匹配,匹配成功則刪除該訂單,并重新統(tǒng)計(jì)該航班剩余票量,并將剩余票量寫(xiě)入到flight.txt中。之后檢查是否有候補(bǔ)乘客,如果有則將剩余票給與候補(bǔ)乘客,以排隊(duì)順序優(yōu)先,并刪除其在候補(bǔ)名單candidate-list的信息。

? 8,最后,在FunctionPanel中的點(diǎn)擊事件中創(chuàng)建三個(gè)判斷語(yǔ)句,創(chuàng)建三個(gè)標(biāo)志位為true,當(dāng)點(diǎn)擊事件為searchPanel時(shí),如果標(biāo)志位為true,則向MainPanel中的CardLayout添加該界面,將標(biāo)志位置為false,之后顯示該界面,其它兩個(gè)與其相同。

二、需求分析

?1.課程設(shè)計(jì)目的

? ? (1).熟練掌握堆隊(duì)列和棧的原理和應(yīng)用。

? ? (2).熟悉Java語(yǔ)言的程序設(shè)計(jì)與開(kāi)發(fā),查缺補(bǔ)漏,提高編程能力。

?2.設(shè)計(jì)任務(wù)

? ? ?線(xiàn)性表

? ? ? 本次課程設(shè)計(jì)使用的線(xiàn)性結(jié)構(gòu)為數(shù)組,用于臨時(shí)存儲(chǔ)用戶(hù)輸入的訂單信息,退票信息,最后將其寫(xiě)入到文件中。

? ? 特殊線(xiàn)性表

? ? ? ?本次課程設(shè)計(jì)使用的特殊線(xiàn)性結(jié)構(gòu)為隊(duì)列,程序中的表格數(shù)據(jù)通過(guò)從文件中讀取,將需要的數(shù)據(jù)臨時(shí)存儲(chǔ)在隊(duì)列中,在將隊(duì)列的數(shù)據(jù)逐條輸出到表格中。

? ??非線(xiàn)性結(jié)構(gòu)

? ? ? ?在本次課程設(shè)計(jì)中,使用的非線(xiàn)性結(jié)構(gòu)為二叉樹(shù),在進(jìn)行模糊搜索時(shí),通過(guò)二叉樹(shù)遍歷數(shù)據(jù)可提高搜索速度。

? ? ?查找和排序

本程序的查找功能采用了KMP搜索搜索算法以及二叉樹(shù)遍歷,排序采用了冒泡排序法。

?3.設(shè)計(jì)環(huán)境

? ? ? ?本次設(shè)計(jì)和開(kāi)發(fā)的平臺(tái)為Windows10,使用Java語(yǔ)言開(kāi)發(fā),編譯環(huán)境為JDK1.8,使用的開(kāi)發(fā)工具為eclipse IDE 2022-03。

三、概要設(shè)計(jì)

?1.數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)

? ? ? (1)線(xiàn)性表數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)

? ?static String[] tab_title = {}//用于存放表頭

? ?//用于將隊(duì)列轉(zhuǎn)化為數(shù)組的方法

? ?public static String[][] queue_to_array(Queue<String[]> queue){

? ? ? ? ? int count=0;//定義一個(gè)int型數(shù)據(jù)充當(dāng)計(jì)數(shù)器

? ? ? ? ? //用于存儲(chǔ)隊(duì)列數(shù)據(jù)的數(shù)組

? ? ? ? ? String[][] get_queue_data=new String[queue.size()][7];

? ? ? ? ? //判斷隊(duì)列中是否還有數(shù)據(jù)

? ? ? ? ? while (queue.size()>0){

? ? ? ? ? ? ? ? ?//從隊(duì)列彈出數(shù)據(jù)并存儲(chǔ)到數(shù)組中

? ? ? ? ? ? ? ? ? get_queue_data[count]=queue.poll();

? ? ? ? ? ? ? ? ? count++;

? ? ? ? ? ?}

? ? ? ? ? //返回?cái)?shù)組

? ? ? ? ? return get_queue_data;

}

(2)特殊線(xiàn)性表數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)

? ?public static?Queue<String[]> queue =

? ?new LinkedList<String[]>();//用于存儲(chǔ)讀取到的符合條件的數(shù)據(jù)

? ?//定義一個(gè)讀取文件的方法

? ?public static void read_txt(String src,Queue<String[]> queue){

? ? ? ? ? ? ? ? ?try {

? ? ? ? ? ? ? ? ? ? ? ? //根據(jù)傳入的地址找到文件

? ? ? ? ? ? ? ? ? ? ? ? File file = new File(src);

? ? ? ? ? ? ? ? ? ? ? ? //定義一個(gè)FileReader

? ? ? ? ? ? ? ? ? ? ? ? ?FileReader fileReader = new FileReader(file); ?

? ? ? ? ? ? ? ? ? ? ? ? ?//定義一個(gè)LineNumberReader用于讀取行數(shù)據(jù)

? ? ?LineNumberReader reader = new LineNumberReader(fileReader);

? ? ? ? ? int number = 1;

? ? ? ? ? String txt = ""; //存儲(chǔ)得到的行數(shù)據(jù)

? ? ? ? ? int lines = 0; //從第一行開(kāi)始讀取

????????while (txt != null) {//如果讀取到的數(shù)據(jù)非空

????????????lines++;//行數(shù)加一

????????????txt = reader.readLine();//繼續(xù)讀取下一行

//當(dāng)讀取到的數(shù)據(jù)不為空時(shí)

?if (lines > number&&txt!=null&&!txt.trim().equals("")) {

? ? ? ? ? ? ? //將當(dāng)前數(shù)據(jù)以“/”分割并存儲(chǔ)到數(shù)組中

???????????? String[] data=txt.split("/");

? ? ? ? ? ? ?//向隊(duì)列中送入讀取到的數(shù)據(jù)

???????????? queue.offer(data);

????????????}

???? }

?//關(guān)閉LineNumberReader

? ? reader.close();

?//關(guān)閉fileReader

? ? fileReader.close();

}catch (IOException e) {

? ? ? ?System.out.println("讀取文件出錯(cuò)");

? ? ? }

}

(3)非線(xiàn)性結(jié)構(gòu)數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)

本次課程設(shè)計(jì)用到的非線(xiàn)性結(jié)構(gòu)只有堆,因?yàn)槎咽且粋€(gè)完全二叉樹(shù),所以在本次課程設(shè)計(jì)中采取的是將堆映射到數(shù)組上的方式來(lái)實(shí)現(xiàn)邏輯上的堆結(jié)構(gòu)的。

(4)查找和排序數(shù)據(jù)結(jié)構(gòu)設(shè)計(jì)

? ? ? public static void filter_txt

?(String src,String starting_point,String end_point,

?String departure_time,Queue<String[]> queue){//篩選航線(xiàn)方法

? ? ? ? ? ? try {

? ? ? ? ? ? ? //根據(jù)傳入的地址找到文件

? ? ? ? ? ? ? ? ?File file = new File(src);

? ? ? ? ? ? ? //定義一個(gè)FileReader

? ? ? ? ? ? ?FileReader fileReader = new FileReader(file); ?

???LineNumberReader reader = new LineNumberReader(fileReader);

? ? ? ? ?int number = 1;

? ? ? ? ?String txt = "";

? ? ? ? ?int lines = 0;

????????while (txt != null) {//如果讀取到的數(shù)據(jù)非空

????????????lines++;

????????????txt = reader.readLine();//繼續(xù)讀取下一行

??????if (lines > number&&txt!=null&&!txt.trim().equals("")) {

//將讀取到的數(shù)據(jù)以“/”分割并存入數(shù)組中

???????????? String[] data=txt.split("/");

?????if(starting_point.trim().equals(data[1])&&end_point.trim().equals(data[2])&&departure_time.trim().equals(data[3].substring(0, 10))) //將符合條件的數(shù)據(jù)存儲(chǔ)隊(duì)列中

???????????? queue.offer(data);

????????????}

????????}

? ? ?//關(guān)閉文件流

? ? ? reader.close();

? ? ?fileReader.close();

? }catch (IOException e) {

? ? ? ?System.out.println("讀取文件出錯(cuò)");

? ?}

}

2.模塊設(shè)計(jì)

? (1)線(xiàn)性表模塊設(shè)計(jì)

? ? ? 本次課程設(shè)計(jì)所采用的線(xiàn)性結(jié)構(gòu)就是數(shù)組,而數(shù)組是在Java語(yǔ)言中自帶的一種結(jié)構(gòu),直接使用即可,無(wú)需做額外設(shè)計(jì)。

??(2)特殊線(xiàn)性表模塊設(shè)計(jì)

? ? ? 本課程設(shè)計(jì)采用的特殊線(xiàn)性表是隊(duì)列,在隊(duì)列中存儲(chǔ)的是來(lái)自文件的數(shù)據(jù),每一條數(shù)據(jù)需要以數(shù)組的形式存儲(chǔ),所以隊(duì)列中存儲(chǔ)的為數(shù)組,所以我們定義了Queue<String[]>這樣的隊(duì)列。

??(3)非線(xiàn)性結(jié)構(gòu)模塊設(shè)計(jì)

? ? ?在本次課程設(shè)計(jì)中,使用的非線(xiàn)性結(jié)構(gòu)為二叉樹(shù),在進(jìn)行模糊搜索時(shí),通過(guò)二叉樹(shù)遍歷數(shù)據(jù)可提高搜索速度。

?(4)查找和排序模塊設(shè)計(jì)

? ? 本程序的查找功能采用了KMP搜索搜索算法以及二叉樹(shù)遍歷,排序采用了冒泡排序法,此模塊主要用于用戶(hù)輸入的信息模糊搜索航班,并將最終結(jié)果以時(shí)間先后進(jìn)行排序。

三、詳細(xì)設(shè)計(jì)

??1.主程序界面及功能的詳細(xì)設(shè)計(jì)

? ? ? ?首先在項(xiàng)目工程中創(chuàng)建Main Frame.java作為主窗口文件,設(shè)置窗口大小為,主題樣式,標(biāo)題欄,窗口圖標(biāo),并添加到當(dāng)前窗口中背景以及窗口可見(jiàn)性,之后創(chuàng)建InitGlobalFont方法,該方法設(shè)置全局字體的樣式和大小。在項(xiàng)目工程中創(chuàng)建FunctionPanel.java類(lèi),并將其添加到MainPanel.java的CardLayout中,并通過(guò)CardLayout.Show方法設(shè)置FunctionPanel為默認(rèn)顯示。在FunctionPanel.java中,創(chuàng)建三個(gè)圖片按鈕,分別代表航班管理,訂票,退票,以及一個(gè)退出按鈕,將按鈕添加到界面中,設(shè)定其位置,并將它們添加點(diǎn)擊事件,點(diǎn)擊航班管理將MainPanel.java的CardLayout.show()設(shè)定為SearchPanel,點(diǎn)擊訂票設(shè)定為AddPanel,點(diǎn)擊訂單管理將其設(shè)為RefundPanel。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??圖1 主程序模塊流程圖

?2.航班管理模塊界面及功能詳細(xì)設(shè)計(jì)

? ? ? ?FunctionPanel.java為航班管理界面,在該文件中,首先創(chuàng)建一個(gè)表格table,逐行讀取flight.txt的所有信息,將其存入隊(duì)列中,再?gòu)年?duì)列彈出將其添加到表格中。創(chuàng)建五個(gè)按鈕,分別為“添加航班”,“刪除航班”,“修改航班”,“刷新”,“返回”,以及一個(gè)文本框和搜索按鈕。點(diǎn)擊“添加航班”,將彈出添加窗口,在窗口中輸入航班信息,點(diǎn)擊確定即可將該信息添加到flight.txt文件中,并刷新表格。選中某表格中的某一條信息,點(diǎn)擊“刪除航班”,將會(huì)獲取該行中的航班號(hào),根據(jù)該航班號(hào)與flight.txt文件進(jìn)行逐行匹配,匹配成功則將其刪除,并刷新表格。選中某一條信息 點(diǎn)擊“修改航班”,過(guò)程與刪除航班類(lèi)似,匹配成功后對(duì)該行覆蓋寫(xiě)入,并刷新表格。點(diǎn)擊“刷新”,會(huì)重新讀取文件,將其顯示在表格中。點(diǎn)擊“返回”,會(huì)使MainPanel的CardLayout顯示FunctionPanel,即主界面。在文本框中輸入關(guān)鍵詞,點(diǎn)擊“搜索”按鈕,會(huì)將從文本框獲取的數(shù)據(jù)與flight.txt進(jìn)行逐行匹配,將匹配成功的信息存入隊(duì)列中,之后將隊(duì)列中的信息輸出在表格中。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ???圖2 航班管理模塊流程圖

3.????機(jī)票預(yù)定模塊界面及功能詳細(xì)設(shè)計(jì)

? ? ? ?在項(xiàng)目工程中創(chuàng)建addPanel.java,作為航班訂票界面,在該界面中創(chuàng)建一個(gè)表格,以及三個(gè)按鈕,分別為“訂票”,“候補(bǔ)乘客”,“返回”,在data/ program-store文件夾中創(chuàng)建book-list.txt,用于存儲(chǔ)訂單,創(chuàng)建candidata-list.txt文件,用于存儲(chǔ)候補(bǔ)乘客。表格中顯示當(dāng)前所有航班,點(diǎn)擊某一條信息,點(diǎn)擊“訂票”,輸入乘客信息,數(shù)量,如果剩余票充足,則將當(dāng)前的航班號(hào),乘客信息,數(shù)量寫(xiě)入到book-list.txt文件中,并修改light.txt文件的該航班剩余票數(shù)。若余票不足,則提示是否列入候該航線(xiàn)的候補(bǔ)名單中。選中某一條航班,點(diǎn)擊“候補(bǔ)乘客”,則會(huì)讀取candidate-list.txt文件,并彈出新窗口以表格的形式顯示。點(diǎn)擊“返回”,則返回到主界面,點(diǎn)擊“搜索”,則會(huì)根據(jù)輸入的關(guān)鍵字和日期與flight.txt中的航班信息進(jìn)行匹配,將所有匹配成功的信息存入隊(duì)列中,清空表格,之后將隊(duì)列中的信息輸出在表格中,并以時(shí)間先后排序。

圖3 航班管理模塊流程圖

? 4.???????訂單管理模塊界面及功能詳細(xì)設(shè)計(jì)

? ? ? ?在項(xiàng)目工程中創(chuàng)建deletePanel.java,作為航班退票界面,在該界面中創(chuàng)建一個(gè)表格,以及三個(gè)按鈕,分別為“退票”,“候補(bǔ)乘客”,“返回”,以及一個(gè)文本框和“搜索”按鈕,表格中顯示當(dāng)前所有訂單,選中某一條訂單,點(diǎn)擊“退票”,則會(huì)根據(jù)航班號(hào)與book-list.txt文件里航班號(hào)匹配,匹配成功則刪除該訂單,并重新統(tǒng)計(jì)該航班剩余票量,并將剩余票量寫(xiě)入到flight.txt中。之后檢查是否有候補(bǔ)乘客,如果有則將剩余票給與候補(bǔ)乘客,以排隊(duì)順序優(yōu)先,并刪除其在候補(bǔ)名單candidate-list的信息。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?圖4 訂單模塊流程圖

四、測(cè)試分析

? 1.???????主程序界面及功能測(cè)試分析

? ? ? ? ?首先對(duì)主頁(yè)測(cè)試分析,如圖 5所示:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?圖5 航空訂票系統(tǒng)主界面

? ? ? ?窗口可以正常出現(xiàn),圖片的點(diǎn)擊事件可以正常響應(yīng),當(dāng)點(diǎn)擊航班檢索時(shí),頁(yè)面正常切換到航班檢索界面,如圖6。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?圖6 航班檢索界面

? ? ? ?點(diǎn)擊返回可以正常返回主頁(yè),并沒(méi)有出現(xiàn)頁(yè)面卡死或無(wú)法切換的情況,由此可以說(shuō)明主界面沒(méi)有問(wèn)題。

? ? ??

? ? ?其功能實(shí)現(xiàn)的主要代碼是:

? ? ? public void mouseClicked(MouseEvent e) {

? ? ? ? ? ?// TODO Auto-generated method stub

? ? if(e.getSource().equals(icon_search)||e.getSource().equals(icon_search_text)) {

? ? ? ? ? ? if(searchPanel_on)

? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ? ?SearchPanel searchPanel=new SearchPanel();

? ? ? ? ? ? ? ? ? ?MainPanel.jPanel.add(searchPanel,"searchPanel");

? ? ? ? ? ? ? ? ? searchPanel_on=false;

? ? ? ? ? ? ?}

? ? ? MainPanel.cardLayout.show(MainPanel.jPanel,"searchPanel");

? ? ? ?}else

? ? if(e.getSource().equals(icon_add)||e.getSource().equals(icon_add_text)) {

? ? ? ? ? ? ? ? ? if(addPanel_on)

? ? ? ? ? ? ? ? ? ? {

? ? ? ? ? ? ? ? ? ? ? ? AddPanel addPanel=new AddPanel();

? ? ? ? ? ? ? ? ? ? ? ? MainPanel.jPanel.add(addPanel,"addPanel");

? ? ? ? ? ? ? ? ? ? ? ? addPanel_on=false;

? ? ? ? ? ? ? ? ? ? }

? ? ? ? ? ? ? ?MainPanel.cardLayout.show(MainPanel.jPanel,"addPanel");

? ? ? ? ? ? ? ? ?}else

? ? ? ? ? ?if(e.getSource().equals(icon_delete)||e.getSource().equals(icon_delete_text)) {

? ? ? ? ? ? ? ? ? ? ? ? if(refundPanel_on)

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?{

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? RefundPanel refundPanel=new RefundPanel();

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? MainPanel.jPanel.add(refundPanel,"refundPanel");

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? refundPanel_on=false;

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? }

?MainPanel.cardLayout.show(MainPanel.jPanel,"refundPanel");

? ? ? ?}

}

2.???????航班管理模塊功能測(cè)試分析

? ? ?下面進(jìn)行航班檢索模塊的測(cè)試:

? ? ?點(diǎn)擊航班檢索,頁(yè)面將切換到航班檢索界面,如圖7所示:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?圖7 航班檢索界面

? ? ? ? 點(diǎn)擊添加航班,將彈出添加界面,如圖8所示,輸入所有信息后點(diǎn)擊確定即可添加,表格自動(dòng)刷新。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??圖8 航班添加窗口?

? ? ? ?點(diǎn)擊刪除航班,將彈出提示是否刪除,點(diǎn)擊確定后,即可刪除該航班。

? ? ? ?在搜索框中輸入關(guān)鍵信息,點(diǎn)擊“搜索”即可查詢(xún),查詢(xún)到的結(jié)果顯示在表格中。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??圖9 航班查詢(xún)功能

? ? ? ? ? 其功能實(shí)現(xiàn)的主要代碼是:

?public void delete() {

? ? int count=table.getSelectedRow();

? ? if(count>=0) {

? ? ?String getname= table.getValueAt(count, 0).toString();

? ? FileOperations.delete_txt_line("src/data/storage/flight.txt", getname, false);

? ? ?refresh_table();

}else {

? JOptionPane.showMessageDialog(null, "請(qǐng)選中列表中的某一行!!", "提示", 0);

? }

}

? ?public void search_table() {

?FileOperations.search_txt_line("src/data/storage/flight.txt",search_bar.getText(),Constant.queue,0);

? ? ?table_mode =new DefaultTableModel();

? ? ?table_mode.setColumnIdentifiers(tab_title);

? ? ?while(Constant.queue.size()>0) {

? ? ? ?table_mode.addRow(Constant.queue.poll());

? ? ? }

? ? ? table.setModel(table_mode);

? ? ? }

public void actionPerformed(ActionEvent e) {

String?get_data="\n"+flight_number.getText()+"/"

+starting_station.getText()+"/"+terminal_station.getText()+"/"+departure_time.getText() +"/"+arrival_time.getText()+"/"+crew_quota.getText()+"/"+total_votes.getText()+"/"+total_votes.getText();

?FileOperations.write_txt("src/data/storage/flight.txt",get_data);

? ?refresh_table();

? ?add_window_JFrame.dispose();

}

3 .機(jī)票預(yù)定模塊功能測(cè)試分析

? ? 下面進(jìn)行機(jī)票預(yù)訂模塊的測(cè)試:

? 點(diǎn)擊機(jī)票預(yù)訂,頁(yè)面將切換到機(jī)票預(yù)訂界面,如圖9所示:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??圖9 機(jī)票預(yù)定模塊界面

? ? ? ?選中某一航班,點(diǎn)擊“訂票”,頁(yè)面將彈出機(jī)票預(yù)訂窗口,如圖10所示,輸入信息,點(diǎn)擊確定即可訂票。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?圖10 機(jī)票預(yù)定窗口

? ? ? ? 選中某一航班,點(diǎn)擊“訂單”,頁(yè)面將彈出當(dāng)前航班訂單窗口,如圖11所示,顯示當(dāng)前成功購(gòu)票和候補(bǔ)購(gòu)票名單。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?圖11 航班當(dāng)前訂單窗口

? ? ? ? 在右上角的文本框中輸入起始站,終點(diǎn)站,出發(fā)日期,點(diǎn)擊“搜索”,即可顯示滿(mǎn)足條件的航班,如圖12所示。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?圖12 航班篩選功能

其功能實(shí)現(xiàn)的主要代碼是:

public void search_table() {

?FileOperations.filter_txt("src/data/storage/flight.txt",starting_station_textField.getText(),terminal_station_textField.getText(),departure_time_textField.getText(),Constant.queue);

? ?table_mode =new DefaultTableModel();

? ?table_mode.setColumnIdentifiers(tab_title);

? ?while(Constant.queue.size()>0) {

? ? table_mode.addRow(Constant.queue.poll());

?}

? table.setModel(table_mode);

?}

?public void delete() {

? ?int count=table.getSelectedRow();

? ?if(count>=0) {

? ? ?String getname= table.getValueAt(count, 0).toString();

? ? FileOperations.delete_txt_line("src/data/storage/flight.txt", getname, false);

? ?refresh_table();

?}else {

JOptionPane.showMessageDialog(null, " ????請(qǐng)選中列表中的某一行!!", "提示", 0);}}

4.???????訂單管理模塊功能測(cè)試分析

?下面進(jìn)行訂單管理模塊的測(cè)試:

? 點(diǎn)擊訂單管理,頁(yè)面將切換到訂單管理界面,如圖13所示:

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??圖13 訂單管理模塊界面

? ? ? ?選中某一航班,點(diǎn)擊“退票”,將彈出退票界面,如圖14所示,輸入退票數(shù)量,點(diǎn)擊“確定”,即可完成退票。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ??圖14 訂單管理模塊

? ? ? 選中某一航班,點(diǎn)擊“詳情”,將彈出該航班詳細(xì)信息界面,如圖15所示。

? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ? ?圖15 航班詳情界面

? ? ? ?在搜索框中輸入關(guān)鍵信息,點(diǎn)擊搜索即可顯示搜索到的訂單,具體界面上文已有所提到,這里不多贅述。

? ? ? ?其功能實(shí)現(xiàn)的主要代碼是:

public static void delete_line(JTable table) {

? ?int count=table.getSelectedRow();

? ?if(count>=0) {

?if(JOptionPane.showConfirmDialog(null, "是否刪除當(dāng)前所選候補(bǔ)信息", "注意", JOptionPane.YES_NO_OPTION)==JOptionPane.YES_OPTION) {

?FileOperations.delete_txt_line("src/data/storage/alternate.txt",table.getValueAt(count, 0).toString(),true);

? ? ? ? ? ? ? ? ? JOptionPane.showMessageDialog(null, " ???刪除成功!!", "提示", 1);

? ? ? ? ? ? refresh_table("src/data/storage/alternate.txt", table_mode2, table2, order_tab_title2,true);

}

}else {

? ?JOptionPane.showMessageDialog(null, " ????請(qǐng)選中列表中的某一行!!", "提示", 1);

? ?}

}

public void actionPerformed(ActionEvent e) {

?if(e.getSource().equals(refund_button)) {//退票

? ?OrderWindow.refund_window(table_mode1,table1,order_tab_title1);

?}else if(e.getSource().equals(details_button1)) {//詳情1

OrderWindow.details_window(table1);

}else if(e.getSource().equals(booking_button)){

? ? booking();

? }else if(e.getSource().equals(delete_button)) {//刪除

? ? delete_line(table2);

? }else if(e.getSource().equals(refresh_button1)||e.getSource().equals(refresh_button2)) {//刷新

? ? refresh_table("src/data/storage/booking.txt", table_mode1, table1, order_tab_title1,true);

? ? refresh_table("src/data/storage/alternate.txt", table_mode2, table2, order_tab_title2,true);

?}else if(e.getSource().equals(return_button1)||e.getSource().equals(return_button2)) {//返回

? ? ? ? MainPanel.cardLayout.show(MainPanel.jPanel,"featuresPanel");

?}else if(e.getSource().equals(search_button1)) {

?FileOperations.search_txt_line("src/data/storage/booking.txt",search_bar1.getText(),Constant.queue,0);

?refresh_table("src/data/storage/booking.txt", table_mode1, table1, order_tab_title1,false);

?}else if(e.getSource().equals(search_button2)) {

?refresh_table("src/data/storage/alternate.txt", table_mode2, table2, order_tab_title2,false);

? }

}

下載鏈接:數(shù)據(jù)結(jié)構(gòu)課設(shè)之航空訂票系統(tǒng)(Java).zip-Java文檔類(lèi)資源-CSDN下載

??

總結(jié)

以上是生活随笔為你收集整理的数据结构课设之航空订票系统(Java)下载链接在文末的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問(wèn)題。

如果覺(jué)得生活随笔網(wǎng)站內(nèi)容還不錯(cuò),歡迎將生活随笔推薦給好友。