课程设计报告-民航订票系统方案_第1页
课程设计报告-民航订票系统方案_第2页
课程设计报告-民航订票系统方案_第3页
课程设计报告-民航订票系统方案_第4页
课程设计报告-民航订票系统方案_第5页
已阅读5页,还剩38页未读 继续免费阅读

付费下载

下载本文档

版权说明:本文档由用户提供并上传,收益归属内容提供方,若内容存在侵权,请进行举报或认领

文档简介

下载可编辑民航订票系统一、设计目的与内容1.设计目的熟练掌握数据的存储表示和基本操作的实现 ,能够利用存储设计算法解决简单的航空订票问题。2.设计内容:录入:可以录入航班情况(数据可以存储在一个数据文件中 ,数据结构、具体数据自定)查询:可以查询某个航线的情况 (如,输入航班号,查询起降时间,起飞抵达城市,航班票价,票价折扣,确定航班是否满仓);可以输入起飞抵达城市,查询飞机航班情况;订票:(订票情况可以存在一个数据文件中,结构自己设定)可以订票,如果该航班已经无票,可以提供相关可选择航班;输出:可以按照航班号为顺序输出订票信息。二、算法的基本思想.专业.整理.下载可编辑飞机订票系统主界面管 客理 户员录查查修查查订退入看看改看看票票航航客航航订班班户班班票信信信信信信息息息息息息算法的主要思路是:1.首先对界面的设计,可以对操作的人员来说简单上手 。对系统的应用都能进行相应的操作。1)设置管理员的功能。2)设置客户的功能3)管理员的主要操作界面4)客户的主要操作界面5)结束2.类dingpiao 用来显示客户订票的事件 ;基本思路如下:1)客户提交自己的详细信息。2)管理员处理相应的内容并给票给客户。.专业.整理.下载可编辑(3)订票结束3.类tuipiao将处客户的退票的信息 ,释放存储空间,基本思路如下:1)客户提交自己的详细信息。2)管理员把客户的票取出,3)结束三、E-R图.专业.整理.下载可编辑系统流程图该系统的数据流程图如图 3-3: 客户端启登陆No有效数据?yes出票航班查询修改密码No输入查询条件已查航班?输入新密码验证有效?No输入乘客信息Noyes验证有效No验证有效?yes封装requset对yes象将request对象写向服务分拣请求出票请求查询航班请求修改密码请求登陆请求调用调用调用调用封装response对象将response对象写往客户解析 request对象将结果显示在客.专业.整理.下载可编辑四、测试数据程序运行实例如下:1主界面的进入:管理员的相应功能用户的相应功能管理员录入订票信息.专业.整理.下载可编辑客户注册模块客户添加信息模块.专业.整理.下载可编辑客户订票界面客户退票界面.专业.整理.下载可编辑五、源程序及系统文件使用说明1用java写的飞机订票系统的主界面可以直观的观察操作的界面 ,所应用的代码如下所示:packageFlightManagementSystem;publicclassWelcome extendsJFrameimplementsActionListener{/**.专业.整理.下载可编辑**/privatestaticfinallongserialVersionUID=1L;publicstaticfinalStringFlight=null;//声明JButton组件对象JButtonjbutton1,jbutton2,jbutton3,jbutton4;publicWelcome(){super("欢迎进入民航订票系统!");设置内容面板的布局模式为:流动布局getContentPane().setLayout(newFlowLayout());jbutton1=newJButton(" 管理系统");jbutton2=newJButton(" 客户系统");jbutton4=newJButton(" 退 出 系 统 ");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);注册监听器jbutton1.addActionListener(this);jbutton2.addActionListener(this);jbutton4.addActionListener(this);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==jbutton1){@SuppressWarnings("unused")LoginOfManagers=newLoginOfManager();this.dispose();}.专业.整理.下载可编辑if(e.getSource()==jbutton2){try{newLogin();}catch(Exceptione1){TODOAuto-generatedcatchblocke1.printStackTrace();}this.dispose();}if(e.getSource()==jbutton4){System.exit(0);}}publicvoidairportInformation(){谢谢光临!");}.专业.整理.下载可编辑publicstaticvoidmain(String[]args){@SuppressWarnings("unused")Welcomewelcome=newWelcome();}}2管理员的操作界面也是简单易懂 ,利于上手。实现的代码如下所示:packageFlightManagementSystem;.专业.整理.下载可编辑publicclassManagementFrameextendsJFrameimplementsActionListener{//声明JButton组件对象JButtonjbutton1,jbutton2,jbutton3,jbutton4,jbutton5;publicManagementFrame(){super("欢迎进入管理系统!");设置内容面板的布局模式为:流动布局getContentPane().setLayout(newFlowLayout());jbutton1=newJButton(" 录入航班信息");jbutton2=newJButton(" 查看航班信息");jbutton3=newJButton(" 修改航班信息");jbutton4=newJButton(" 查看客户信息");jbutton5=newJButton(" 返 回 ");getContentPane().add(jbutton1);getContentPane().add(jbutton2);.专业.整理.下载可编辑getContentPane().add(jbutton3);getContentPane().add(jbutton4);getContentPane().add(jbutton5);this.setBounds(300,200,360,130);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);注册监听器jbutton1.addActionListener(this);jbutton2.addActionListener(this);jbutton3.addActionListener(this);jbutton4.addActionListener(this);jbutton5.addActionListener(this);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==jbutton1){newInsertInfomation();this.dispose();}.专业.整理.下载可编辑if(e.getSource()==jbutton2){newQueryflight();this.dispose();}if(e.getSource()==jbutton3){newReviseInformation();this.dispose();}if(e.getSource()==jbutton4){newQueryclient();this.dispose();}if(e.getSource()==jbutton5){newWelcome();this.dispose();}}.专业.整理.下载可编辑publicstaticvoidmain(String[]args){newManagementFrame();}}3客户进入后的操作界面 ,可是实现用户的各种操作 ,例如订票,退票,查询信息等。packageFlightManagementSystem;.专业.整理.下载可编辑publicclassBookextendsJFrameimplementsActionListener{/****/intdingdannum=10000000; //设置初始订单号;privatestaticfinallongserialVersionUID=1L;JLabell4=newJLabel(" 订票数量 :");JLabell2=newJLabel(" 航 班 号 :");JLabell3=newJLabel(" 请输入您要订票的航班号和机票数量 !一次不能超过5张票!");JLabell1=newJLabel(" 姓 名 :");JTextFieldt1=newJTextField("",12);JTextFieldt2=newJTextField("",12);JTextFieldt3=newJTextField("",12);JButtonb1=newJButton(" 确认订票");JButtonb2=newJButton(" 返 回 ");JPanelp1=newJPanel();JPanelp2=newJPanel();.专业.整理.下载可编辑JPanelp3=newJPanel();JPanelp4=newJPanel();JPanelp5=newJPanel();Stringflight;Connectioncon;Statementstmt=null;ResultSetrs;Stringurl="jdbc:odbc:ylb";Book()throwsException{super("欢迎进入订票界面!");p1.add(l3);p2.add(l1);p2.add(t1);p3.add(l2);p3.add(t2);p4.add(l4);p4.add(t3);p5.add(b1);p5.add(b2);.专业.整理.下载可编辑b1.addActionListener(this);b2.addActionListener(this);setLayout(newGridLayout(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")publicvoidactionPerformed(ActionEvente){if(e.getSource()==b2){.专业.整理.下载可编辑newEnterance();this.dispose();}if(e.getSource()==b1){获取用户输入的信息Stringjt1=t1.getText();Stringjt2=t2.getText();Stringjt3=t3.getText();inttt=Integer.parseInt(jt3);if(tt>5){l3.setText("请减少购票数量!");}else{if(jt1.equals("")||jt2.equals("")||jt3.equals("")){l3.setText("所填信息不能为空!");}.专业.整理.下载可编辑else{try{con=DriverManager.getConnection(url,"","");stmt=con.createStatement();int count=stmt.executeUpdate("insert into bookvalues('"+jt1+"','"+jt2+"',"+tt+")");rs=stmt.executeQuery("select*fromflightwhere 航班号='"+jt2+"'"); 查询航班信息成功!");获取该航班信息Stringfl1=null;Stringfl2=null;Stringfl3=null;fl1=rs.getString(2); //起飞时间fl2=rs.getString(3); //起飞地点.专业.整理.下载可编辑fl3=rs.getString(4);Stringfl5=null;fl5=rs.getString(5); //票价intfl6=rs.getInt(6); //最大人数intfl4=rs.getInt(7); //当前人数intshengyu=fl6-fl4; //计算该航班剩余票数if(shengyu<0){l3.setText("该航班已剩"+shengyu+" 张票!");}else{for(inti=0;i<tt;i++){fl4=fl4+1;dingdannum=dingdannum+1;dingdannum=dingdannum+fl4+fl6*i;String sql="insert into ORDER1 values("+dingdannum+",'"+jt1+"','"+jt2+"',"+fl4+",'"+fl5.专业.整理.下载可编辑+"','"+fl1+"','"+fl2+"','"+fl3+"')";stmt.executeUpdate(sql);}if(shengyu>0)stmt.executeUpdate("update flight set 目前人数="+fl4+"where 航班号='"+jt2+"'");if(shengyu==0)stmt.executeUpdate("update flight set 目前人数="+fl4+" 是否满仓='是'"+"where 航班号='"+jt2+"'");}}}catch(Exceptione2){e2.printStackTrace();}}}}.专业.整理.下载可编辑}/* publicvoidtreat(inti,Stringa,Stringb){Stringhangbanhao=a; //获得航班号航班号为:"+hangbanhao);Stringname=b;intzuoweihao=0; //座位号intticketnum=i; //获得订票数intmax=0; //航班最大人数订票数为:"+ticketnum);try{Connectioncc=DriverManager.getConnection(url,"",""); 查询连接成功!");}Statementsta=cc.createStatement();查询预定航班的人数,以便获得座位号ResultSetres=sta.executeQuery("select*fromflightwhere"+"航班号='"+hangbanhao+"'");.专业.整理.下载可编辑while(res.next()){ 存在!");Stringshijian=res.getString(2);时间="+shijian);Stringqifeididian=res.getString(3);起飞地点="+qifeididian);Stringdaodadidian=res.getString(4);到达地点="+daodadidian);intpiaojia=res.getInt(5);票价="+piaojia);max=res.getInt(6);最大人数="+max);zuoweihao=res.getInt(7);座位号="+zuoweihao);try{Connectionccc=DriverManager.getConnection(url,"","");Statementstat=ccc.createStatement();for(intj=0;j<ticketnum;j++){.专业.整理.下载可编辑String sqll="insert into ORDER1values('"+name+"','"+hangbanhao+"',"+(zuoweihao+1)+","+piaojia+",'"+shijian+"','"+qifeididian+"','"+daodadidian+"'";}while(max!=0){if(max!=zuoweihao)stat.executeUpdate("update flight set 目前人数="+zuoweihao+"where 航 班 号='"+hangbanhao+"'");else{{stat.executeUpdate("updateflightset 目前人数="+zuoweihao+",是否满仓='是'"+"where 航班号='"+hangbanhao+"'");}}}zuoweihao=zuoweihao+i;if((zuoweihao+i)>max){this.dispose();.专业.整理.下载可编辑newBook();l3.setText("该航班:"+hangbanhao+" 票数已超出!");}}catch(Exceptione){}更新座位号更改后的人数="+zuoweihao);}}catch(Exceptione){}}*/publicstaticvoidmain(String[]args)throwsException{newBook();}.专业.整理.下载可编辑}4录入修改航班的代码,对订票信息的确定,并且对相应的信息进行修改 。packageFlightManagementSystem;publicclassQueryclient extendsJFrameimplementsActionListener{/****/privatestaticfinallongserialVersionUID=1L;JLabeljl1=newJLabel(" 姓 名 :");JLabeljl6=newJLabel("登机时间:");JLabeljl7=newJLabel("出发地点:");JLabeljl8=newJLabel("目的地点:");.专业.整理.下载可编辑JLabeljl2=newJLabel("证 件号 :");JLabeljl5=newJLabel("所乘航班:");JLabeljl3=newJLabel(" 性 别 :");JLabeljl4=newJLabel(" 年 龄 :");privateJTextFieldjd1=newJTextField(15);privateJTextFieldjd2=newJTextField(15);privateJTextFieldjd3=newJTextField(15);privateJTextFieldjd8=newJTextField(15);privateJTextFieldjd4=newJTextField(15);privateJTextFieldjd5=newJTextField(15);privateJTextFieldjd6=newJTextField(15);privateJTextFieldjd7=newJTextField(15);JButtonquery=newJButton(" 查 询");JButtonouturan=newJButton(" 返 回");JLabel[]jl={jl1,jl2,jl3,jl4,jl5,jl6,jl7,jl8};privateJTextField[]jt={jd1,jd2,jd3,jd4,jd5,jd6,jd7,jd8};.专业.整理.下载可编辑Boxbox1=Box.createVerticalBox(); //创建纵向Box容器privateBoxbox2=Box.createVerticalBox();Boxbox3=Box.createHorizontalBox(); //创建横向Box容器Connectioncon;Statementstmt;ResultSetrs;Stringurl="jdbc:odbc:ylb";public Queryclient(){this.setTitle("查询客户信息");this.setBounds(300,200,260,365);this.setVisible(true);this.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);this.setResizable(false);this.add(box3); //将横向Box容器box3添加到窗体中.专业.整理.下载可编辑box3.add(Box.createRigidArea(newDimension(20,20)));box3.add(box1); //将纵向Box容器box1添加到横向Box容器box3中box3.add(box2); //将纵向Box容器box2添加到横向Box容器box3中query.addActionListener(this);outuran.addActionListener(this);for(inti=0;i<8;i++){box1.add(jl[i]);box1.add(Box.createVerticalStrut(20));}box1.add(query);for(inti=0;i<8;i++).专业.整理.下载可编辑{box2.add(jt[i]);box2.add(Box.createVerticalStrut(16));}box2.add(outuran);jd1.setText("请输入需查询的姓名!");}publicvoidactionPerformed(ActionEvente){Stringgetflight=null; //定义该客户航班号if(e.getSource()==query){Stringt1=jd1.getText();jd3.setText(t1);try{con=DriverManager.getConnection(url,"","");stmt=con.createStatement();rs=stmt.executeQuery("select*fromclientwhere 姓名='"+t1+.专业.整理.下载可编辑"'");while(rs.next()){for(inti=1;i<4;i++){jt[i].setText(rs.getString(i+1));}}ResultSetres=stmt.executeQuery("select*frombookwhere 姓名='"+t1+"'");while(res.next()){getflight=res.getString(2);jt[4].setText(getflight);ResultSet ress = stmt.executeQuery("select * from flightwhere 航班号='"+getflight+"'");while(ress.next()){jt[5].setText(ress.getString(2));jt[6].setText(ress.getString(3));jt[7].setText(ress.getString(4));}}.专业.整理.下载可编辑}catch(Exceptione2){}}if(e.getSource()==outuran){try{newManagementFrame();}catch(Exceptione1){TODOAuto-generatedcatchblocke1.printStackTrace();}this.dispose();}.专业.整理.下载可编辑}publicstaticvoidmain(String[]args){newQueryclient();}}5顾客订票退票的代码,packageFlightManagementSystem;.专业.整理.下载可编辑publicclassReturnextendsJFrameimplementsActionListener{/****/privatestaticfinallongserialVersionUID=1L;JLabell1=newJLabel(" 姓 名 :");JLabell2=newJLabel(" 航班号: ");JLabell3=newJLabel(" 请输入您要退票的订单号和航班号 !");JLabell4=newJLabel(" 订单号: ");JTextFieldt1=newJTextField("",12);JTextFieldt2=newJTextField("",12);JTextFieldt3=newJTextField("",12);JButtonb1=newJButton(" 确认退票");JButtonb2=newJButton(" 返 回 ");JPanelp1=newJPanel();JPanelp2=newJPanel();JPanelp3=newJPanel();JPanelp4=newJPanel();JPanelp5=newJPanel();Stringname;Connectioncon;.专业.整理.下载可编辑Statementstmt;ResultSetrs;ResultSetrs1;Stringurl="jdbc:odbc:ylb";Return()throwsException{super("欢迎进入退票界面!");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);p4.add(b2);b1.addActionListener(this);b2.addActionListener(this);setLayout(newGridLayout(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);}publicstaticvoidmain(String[]args)throwsException{newReturn();}publicvoidactionPerformed(ActionEvente){Stringjt1=t1.getText();Stringjt2=t2.getText();Stringjt3=t3.getText();Stringfli=null;inttt=Integer.parseInt(jt3);intzuoweihao=0;if(e.getSource()==b2){newEnterance();.专业.整理.下载可编辑dispose();}if(e.getSource()==b1){if(jt1.equals("")||jt2.equals("")){l3.setText("姓名和航班号不能为空 !");}else{try{con=DriverManager.getConnection(url,"","")

温馨提示

  • 1. 本站所有资源如无特殊说明,都需要本地电脑安装OFFICE2007和PDF阅读器。图纸软件为CAD,CAXA,PROE,UG,SolidWorks等.压缩文件请下载最新的WinRAR软件解压。
  • 2. 本站的文档不包含任何第三方提供的附件图纸等,如果需要附件,请联系上传者。文件的所有权益归上传用户所有。
  • 3. 本站RAR压缩包中若带图纸,网页内容里面会有图纸预览,若没有图纸预览就没有图纸。
  • 4. 未经权益所有人同意不得将文件中的内容挪作商业或盈利用途。
  • 5. 人人文库网仅提供信息存储空间,仅对用户上传内容的表现方式做保护处理,对用户上传分享的文档内容本身不做任何修改或编辑,并不能对任何下载内容负责。
  • 6. 下载文件中如有侵权或不适当内容,请与我们联系,我们立即纠正。
  • 7. 本站不保证下载资源的准确性、安全性和完整性, 同时也不承担用户因使用这些下载资源对自己和他人造成任何形式的伤害或损失。

评论

0/150

提交评论