課程設計報告_民航訂票系統(tǒng)方案_第1頁
課程設計報告_民航訂票系統(tǒng)方案_第2頁
課程設計報告_民航訂票系統(tǒng)方案_第3頁
課程設計報告_民航訂票系統(tǒng)方案_第4頁
已閱讀5頁,還剩21頁未讀, 繼續(xù)免費閱讀

下載本文檔

版權說明:本文檔由用戶提供并上傳,收益歸屬內(nèi)容提供方,若內(nèi)容存在侵權,請進行舉報或認領

文檔簡介

1、下載可編輯民航訂票系統(tǒng)一、設計目的與容1設計目的熟練掌握數(shù)據(jù)的存儲表示和基本操作的實現(xiàn),能夠利用存儲設計算法解決簡單的航空訂票問題。2設計容:錄入:可以錄入航班情況(數(shù)據(jù)可以存儲在一個數(shù)據(jù)文件中,數(shù)據(jù)結構、具體數(shù)據(jù)自定)查詢:可以查詢某個航線的情況(如,輸入航班號,查詢起降時間,起飛抵達城市,航班票價,票價折扣,確定航班是否滿倉);可以輸入起飛抵達城市,查詢飛機航班情況;?訂票:(訂票情況可以存在一個數(shù)據(jù)文件中,結構自己設定)可以訂票,如果該航班已經(jīng)無票,可以提供相關可選擇航班;輸出:可以按照航班號為順序輸出訂票信息。二、算法的基本思想飛機訂票系統(tǒng)主界面管客理戶員錄查查修查查訂退入看看改看看票

2、票航航客航航訂班班戶班班票信信信信信信息息息息息息算法的主要思路是:.專業(yè) .整理 .下載可編輯1首先對界面的設計,可以對操作的人員來說簡單上手。對系統(tǒng)的應用都能進行相應的操作。( 1)設置管理員的功能。( 2)設置客戶的功能( 3)管理員的主要操作界面( 4)客戶的主要操作界面( 5)結束2類 dingpiao用來顯示客戶訂票的事件;基本思路如下:( 1) 客戶提交自己的詳細信息。( 2) 管理員處理相應的容并給票給客戶。( 3) 訂票結束3類 tuipiao將處客戶的退票的信息,釋放存儲空間,基本思路如下:( 1) 客戶提交自己的詳細信息。( 2) 管理員把客戶的票取出,( 3) 結束三、

3、 E-R 圖.專業(yè) .整理 .下載可編輯系統(tǒng)流程圖該系統(tǒng)的數(shù)據(jù)流程圖如圖3-3:客戶端啟登陸No有效數(shù)據(jù)?yes.專業(yè) .整理 .下載可編輯出票航班查詢修改密碼No輸入查詢條件已查航班?輸入新密碼驗證有效?No輸入乘客信息Noyes驗 證有 效No驗證有效?yes封裝 requset 對yes象將 request 對象寫向服務分揀請求出票請求查詢航班請求修改密碼請求登陸請求調(diào)用調(diào)用調(diào)用調(diào)用封裝 response 對象將 response 對象寫往客戶解析request 對象將結果顯示在客四、測試數(shù)據(jù)程序運行實例如下:1 主界面的進入:.專業(yè) .整理 .下載可編輯2 管理員的相應功能3 用戶的相

4、應功能4 管理員錄入訂票信息5 客戶注冊模塊.專業(yè) .整理 .下載可編輯6 客戶添加信息模塊10 客戶訂票界面.專業(yè) .整理 .下載可編輯11 客戶退票界面五、源程序及系統(tǒng)文件使用說明1 用 java 寫的飛機訂票系統(tǒng)的主界面可以直觀的觀察操作的界面,所應用的代碼如下所示:package FlightManagementSystem;public class Welcome extends JFrame implements ActionListener.專業(yè) .整理 .下載可編輯/*/private static final long serialVersionUID = 1L;public

5、 static final String Flight = null;/ 聲明 JButton 組件對象JButton jbutton1,jbutton2,jbutton3,jbutton4;public Welcome()super(" 歡迎進入民航訂票系統(tǒng) !");/ 設置容面板的布局模式為:流動布局 getContentPane().setLayout(new FlowLayout();jbutton1=new JButton("管理系統(tǒng) ");jbutton2=new JButton("客戶系統(tǒng) ");jbutton4=new

6、 JButton("退出系統(tǒng) ");getContentPane().add(jbutton1);getContentPane().add(jbutton2);getContentPane().add(jbutton4);this.setBounds(300,200,240,120);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setResizable(false);/ 注冊監(jiān)聽器 jbutton1.addActionListener(this); jbutto

7、n2.addActionListener(this);jbutton4.addActionListener(this);public void actionPerformed(ActionEvent e)if(e.getSource()=jbutton1)SuppressWarnings("unused")LoginOfManager s=new LoginOfManager();this.dispose();.專業(yè) .整理 .下載可編輯if(e.getSource()=jbutton2)try new Login(); catch (Exception e1) / TOD

8、O Auto-generated catch block e1.printStackTrace();this.dispose();if(e.getSource()=jbutton4)System.exit(0);public void airportInformation()謝謝光臨! ");public static void main(String args)SuppressWarnings("unused")Welcome welcome=new Welcome();2 管理員的操作界面也是簡單易懂,利于上手。實現(xiàn)的代碼如下所示:package Flight

9、ManagementSystem;.專業(yè) .整理 .下載可編輯public class ManagementFrame extends JFrame implements ActionListener / 聲明 JButton 組件對象JButton jbutton1,jbutton2,jbutton3,jbutton4,jbutton5;public ManagementFrame()super(" 歡迎進入管理系統(tǒng) !");/ 設置容面板的布局模式為:流動布局 getContentPane().setLayout(new FlowLayout();jbutton1=ne

10、w JButton("錄入航班信息 ");jbutton2=new JButton("查看航班信息 ");jbutton3=new JButton("修改航班信息 ");jbutton4=new JButton("查看客戶信息 ");jbutton5=new JButton("返回 ");getContentPane().add(jbutton1);getContentPane().add(jbutton2);getContentPane().add(jbutton3);getContentPa

11、ne().add(jbutton4);getContentPane().add(jbutton5);this.setBounds(300,200,360,130);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);/ 注冊監(jiān)聽器 jbutton1.addActionListener(this);jbutton2.addActionListener(this);jbutton3.addActionListener(this);jbutton4.addActionListener(this);jbut

12、ton5.addActionListener(this);public void actionPerformed(ActionEvent e)if(e.getSource()=jbutton1)new InsertInfomation();this.dispose();.專業(yè) .整理 .下載可編輯if(e.getSource()=jbutton2)new Queryflight();this.dispose();if(e.getSource()=jbutton3)new ReviseInformation();this.dispose();if(e.getSource()=jbutton4)n

13、ew Queryclient();this.dispose();if(e.getSource()=jbutton5)new Welcome();this.dispose();public static void main(String args)new ManagementFrame();3 客戶進入后的操作界面,可是實現(xiàn)用戶的各種操作,例如訂票,退票,查詢信息等。package FlightManagementSystem;.專業(yè) .整理 .下載可編輯public class Book extends JFrame implements ActionListener /*/int dingd

14、annum=10000000;/設置初始訂單號 ;private static final long serialVersionUID = 1L;JLabel l4= new JLabel("訂票數(shù)量 :");JLabel l2 = new JLabel("航 班號 :");JLabel l3 = new JLabel("請輸入您要訂票的航班號和機票數(shù)量! 一次不能超過 5 票! ");JLabel l1 = new JLabel("姓名 :");JTextField t1= new JTextField(&quo

15、t;", 12);JTextField t2= new JTextField("", 12);JTextField t3= new JTextField("", 12);JButton b1= new JButton("確認訂票 ");JButton b2= new JButton("返回 ");JPanel p1 = new JPanel();JPanel p2 = new JPanel();JPanel p3 = new JPanel();JPanel p4 = new JPanel();JPanel

16、 p5 = new JPanel();String flight;Connection con;Statement stmt=null;ResultSet rs;String url = "jdbc:odbc:ylb"Book()throws Exceptionsuper("歡迎進入訂票界面! ");p1.add(l3);p2.add(l1); p2.add(t1);p3.add(l2); p3.add(t2);p4.add(l4); p4.add(t3);.專業(yè) .整理 .下載可編輯p5.add(b1); p5.add(b2);b1.addAction

17、Listener(this);b2.addActionListener(this);setLayout(new GridLayout(5,1);this.add(p1);this.add(p2);this.add(p3);this.add(p4);this.add(p5);setBounds(300, 200, 320, 240);setResizable(false);setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);SuppressWarnings("null")public voi

18、d actionPerformed(ActionEvent e) if(e.getSource() = b2)new Enterance();this.dispose();if(e.getSource() = b1)/ 獲取用戶輸入的信息String jt1=t1.getText();String jt2=t2.getText();String jt3=t3.getText();int tt=Integer.parseInt(jt3);if(tt>5)l3.setText("請減少購票數(shù)量! ");elseif(jt1.equals("")| jt

19、2.equals("")|jt3.equals("")l3.setText("所填信息不能為空! ");.專業(yè) .整理 .下載可編輯elsetrycon = DriverManager.getConnection(url, "", "");stmt = con.createStatement();int count=stmt.executeUpdate("insert into book values('"+jt1+"','"+jt

20、2+"',"+tt+")");rs= stmt.executeQuery("select* from flightwhere 航班號 ='"+jt2+"'");查詢航班信息成功! ");/獲取該航班信息String fl1=null;String fl2=null;String fl3=null;fl1=rs.getString(2);/起飛時間fl2=rs.getString(3);/起飛地點fl3=rs.getString(4);String fl5=null;fl5=rs.g

21、etString(5);/票價int fl6=rs.getInt(6);/最大人數(shù)int fl4=rs.getInt(7);/當前人數(shù)int shengyu=fl6-fl4;/計算該航班剩余票數(shù)if(shengyu<0)l3.setText("該航班已剩 "+shengyu+" 票! ");elsefor(int i=0;i<tt;i+)fl4=fl4+1;.專業(yè) .整理 .下載可編輯dingdannum=dingdannum+1;dingdannum=dingdannum+fl4+fl6*i;String sql="insert

22、into ORDER1 values ("+dingdannum+",'"+jt1+"','"+jt2+"',"+fl4+",'"+fl5+"','"+fl1+"','"+fl2+"','"+fl3+"')"stmt.executeUpdate(sql);if(shengyu>0)stmt.executeUpdate(&quo

23、t;updateflightset目前 人數(shù)="+fl4+"where航班號 ='"+jt2+"'");if(shengyu=0)stmt.executeUpdate("updateflightset目前 人數(shù)="+fl4+"是否滿倉 =' 是'"+"where航班號 ='"+jt2+"'"); catch(Exception e2)e2.printStackTrace();/* public void treat(i

24、nt i,String a,String b)String hangbanhao=a;/獲得航班號航班號為: "+hangbanhao);String name=b;int zuoweihao=0;/座位號int ticketnum=i;/獲得訂票數(shù)int max=0;/航班最大人數(shù)訂票數(shù)為: "+ticketnum);try查詢連接成功! ");Statement sta=cc.createStatement();.專業(yè) .整理 .下載可編輯/ 查詢預定航班的人數(shù),以便獲得座位號ResultSetres=sta.executeQuery("select

25、*fromflightwhere " +" 航班號 ='"+hangbanhao+"'"); while(res.next()存在! ");String shijian=res.getString(2);時間 ="+shijian);String qifeididian=res.getString(3);起飛地點 ="+qifeididian);String daodadidian=res.getString(4);到達地點 ="+daodadidian); int piaojia =re

26、s.getInt(5);票價 ="+piaojia);max=res.getInt(6);最大人數(shù) ="+max);zuoweihao=res.getInt(7);座位號 ="+zuoweihao);tryConnectionccc=DriverManager.getConnection(url, "", "");Statement stat=ccc.createStatement();for(int j=0;j<ticketnum;j+)String sqll="insert into ORDER1 val

27、ues('"+name+"','"+hangbanhao+"',"+(zuoweihao+1)+","+piaojia+",'"+shijian+"','"+qifeididian+"','"+daodadidian+"'"while(max!=0) if(max!=zuoweihao)stat.executeUpdate("updateflightset目

28、前人數(shù) ="+zuoweihao+"where航班號='"+hangbanhao+"'");elsestat.executeUpdate("updateflightset目前人數(shù) ="+zuoweihao+",是 否 滿 倉 =' 是 '"+"where航 班 號='"+hangbanhao+"'");.專業(yè) .整理 .下載可編輯zuoweihao=zuoweihao+i;if(zuoweihao+i)>max)

29、this.dispose();new Book();l3.setText("該航班 :"+hangbanhao+" 票數(shù)已超出! ");catch(Exception e)/更新座位號更改后的人數(shù) ="+zuoweihao);catch(Exception e)*/public static void main(String args) throws Exception new Book();4 錄入修改航班的代碼,對訂票信息的確定,并且對相應的信息進行修改。 package FlightManagementSystem;public clas

30、s Queryclient extends JFrame implements ActionListener /*/.專業(yè) .整理 .下載可編輯private static final long serialVersionUID = 1L;JLabel jl1=new JLabel("姓名:");JLabel jl6=new JLabel("登機時間: ");JLabel jl7=new JLabel("出發(fā)地點 : ");JLabel jl8=new JLabel("目的地點: ");JLabel jl2=new

31、 JLabel("證件 號: ");JLabel jl5=new JLabel("所乘航班: ");JLabel jl3=new JLabel("性別:");JLabel jl4=new JLabel("年齡:");private JTextField jd1=new JTextField(15);private JTextField jd2=new JTextField(15);private JTextField jd3=new JTextField(15);private JTextField jd8=new

32、 JTextField(15);private JTextField jd4=new JTextField(15);private JTextField jd5=new JTextField(15);private JTextField jd6=new JTextField(15);private JTextField jd7=new JTextField(15);JButton query=new JButton("查詢 ");JButton outuran=new JButton("返回 ");JLabel jl=jl1,jl2,jl3,jl4,jl

33、5,jl6,jl7,jl8;private JTextField jt=jd1,jd2,jd3,jd4,jd5,jd6,jd7,jd8;Box box1=Box.createVerticalBox();/創(chuàng)建縱向 Box 容器private Box box2=Box.createVerticalBox();Box box3=Box.createHorizontalBox();/創(chuàng)建橫向 Box 容器Connection con;Statement stmt;ResultSet rs;String url = "jdbc:odbc:ylb"public Queryclient

34、()this.setTitle("查詢客戶信息 ");this.setBounds(300,200,260,365);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setResizable(false);.專業(yè) .整理 .下載可編輯this.add(box3);/將橫向 Box容器 box3 添加到窗體中box3.add(Box.createRigidArea(new Dimension(20,20);box3.add(box1);/將縱向 Box容器 box1

35、添加到橫向 Box 容器 box3 中box3.add(box2);/將縱向 Box容器 box2 添加到橫向 Box 容器 box3 中query.addActionListener(this);outuran.addActionListener(this);for(int i=0;i<8;i+)box1.add(jli);box1.add(Box.createVerticalStrut(20);box1.add(query);for(int i=0;i<8;i+)box2.add(jti);box2.add(Box.createVerticalStrut(16);box2.ad

36、d(outuran);jd1.setText("請輸入需查詢的! ");public void actionPerformed(ActionEvent e) String getflight=null; / 定義該客戶航班號 if(e.getSource()=query)String t1=jd1.getText();jd3.setText(t1);.專業(yè) .整理 .下載可編輯trycon = DriverManager.getConnection(url, "", "");stmt = con.createStatement();r

37、s = stmt.executeQuery("select * from client where ='" +t1+"'");while(rs.next()for(int i=1;i<4;i+)jti.setText(rs.getString(i+1);ResultSet res = stmt.executeQuery("select * from book where='" +t1+ "'");while(res.next()getflight=res.getString(2

38、);jt4.setText(getflight);ResultSet ress = stmt.executeQuery("select * from flight where 航班號 ='" +getflight+ "'");while(ress.next()jt5.setText(ress.getString(2);jt6.setText(ress.getString(3);jt7.setText(ress.getString(4);catch(Exception e2)if(e.getSource()=outuran)try new

39、ManagementFrame(); catch (Exception e1) / TODO Auto-generated catch block e1.printStackTrace();.專業(yè) .整理 .下載可編輯this.dispose();public static void main(String args)new Queryclient();5 顧客訂票退票的代碼,package FlightManagementSystem;public class Return extends JFrame implements ActionListener /*/private static

40、final long serialVersionUID = 1L;JLabel l1= new JLabel("姓 名:");JLabel l2 = new JLabel("航班號 : ");JLabel l3 = new JLabel("請輸入您要退票的訂單號和航班號 !");JLabel l4 = new JLabel("訂單號 : ");JTextField t1 = new JTextField("", 12);JTextField t2 = new JTextField("&

41、quot;, 12);JTextField t3 = new JTextField("", 12);JButton b1= new JButton("確認退票 ");JButton b2= new JButton("返回 ");JPanel p1 = new JPanel();JPanel p2 = new JPanel();JPanel p3 = new JPanel();.專業(yè) .整理 .下載可編輯JPanel p4 = new JPanel();JPanel p5 = new JPanel();String name;Conne

42、ction con;Statement stmt;ResultSet rs;ResultSet rs1;String url = "jdbc:odbc:ylb"Return()throws Exceptionsuper("歡迎進入退票界面! ");this.add(p1);this.add(p2);this.add(p3);this.add(p5);this.add(p4);p1.add(l3);p2.add(l1); p2.add(t1);p3.add(l2); p3.add(t2);p5.add(l4); p5.add(t3);p4.add(b1);

43、 p4.add(b2);b1.addActionListener(this);b2.addActionListener(this);setLayout(new GridLayout(5,1);this.add(p1);this.add(p2);this.add(p3);this.add(p5);this.add(p4);setBounds(300, 200, 320, 240);setResizable(false);setVisible(true);public static void main(String args) throws Exception new Return();publi

44、c void actionPerformed(ActionEvent e) String jt1=t1.getText();String jt2=t2.getText();String jt3=t3.getText();.專業(yè) .整理 .下載可編輯String fli=null;int tt=Integer.parseInt(jt3);int zuoweihao=0;if(e.getSource() = b2)new Enterance();dispose();if(e.getSource() = b1)if(jt1.equals("")| jt2.equals("")l3.s

溫馨提示

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

評論

0/150

提交評論