《面向对象程序设计》java课程设计-航空订票管理系统设计_第1页
《面向对象程序设计》java课程设计-航空订票管理系统设计_第2页
《面向对象程序设计》java课程设计-航空订票管理系统设计_第3页
《面向对象程序设计》java课程设计-航空订票管理系统设计_第4页
《面向对象程序设计》java课程设计-航空订票管理系统设计_第5页
已阅读5页,还剩34页未读 继续免费阅读

下载本文档

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

文档简介

计算机学院《面向对象程序设计》课程设计报告学号xxxxxx《面向对象程序设计》课程设计报告题目:xx专业:xx班级:x姓名:xx指导教师:x成绩:xxxx年x月x日目录TOC\o"1-3"\h\u171961设计内容及要求 ④user(用户信息表)(2)数据库设计说明 destine(订票人信息表)在该信息表中包含以下字段:destine_id(订票人身份证号码)、flight_no(航班号)、destine_count(订票数量)、destine_date(定票日期)、destine_status(订票状态)、destine_id(订票人身份证号码)、destine_phone(订票人联系电话)、destine_address(订票人地址)、destine_sex(订票人性别)、destine_age(订票人年龄)等字段。flight(航班信息表)在该信息表中包含以下字段:flight_no(航班号)、begin_from(起飞地点)、end_address(降落地点)、begin_time(起飞时间)、end_time(降落时间)ticket_price(机票价格)等字段。(3)数据库ER图图SEQ图\*ARABIC8数据库ER图4.5程序系统的组织结构(1)系统组织结构图服务器端的组织结构图航空订票管理系统航空订票管理系统管理员身份验证超级管理员一般管理员查询所有信息数据输入查寻内容输出数据航班信息管理订票人信息管理添加数据查询数据删除数据修改数据添加数据删除数据修改数据查询数据输入新航班数据保存航班数据删除航班数据刷新数据刷新输出数据修改航班数据更新航班数据刷新航班数据输入查询数据输出数据输入订票人数据保存订票人数据删除订票人数据刷新数据刷新输出数据修改订票人数据更新订票人数据刷新航班数据输入查询数据输出数据系统层次结构图(服务器)端)图SEQ图\*ARABIC9系统层次结构图6系统运行效果与操作图SEQ图\*ARABIC10主操作界面代码如下:packageflight;importjava.awt.GridLayout;importjavax.swing.*;importjava.awt.event.*;publicclassRegisterextendsJFrameimplementsActionListener{JTextFielduser;JPasswordFieldpsw1,psw2;JLabela,b,c;JButtonok,no;publicRegister(){a=newJLabel("订票"); a.setBounds(70,70,60,25); b=newJLabel("管理"); b.setBounds(77,130,60,25);c=newJLabel("退出");c.setBounds(60,190,60,25); user=newJTextField(20); user.setBounds(130,70,180,25); psw1=newJPasswordField(20); psw1.setBounds(130,130,180,25);psw2=newJPasswordField(20); psw2.setBounds(130,190,180,25);add(a); add(user); add(b); add(psw1);add(c);add(psw2);setLayout(null); setBounds(100,200,500,350);setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); setVisible(true);}publicvoidactionPerformed(ActionEvente){Stringa,b,c;if(e.getSource()==ok){a=user.getText();b=psw1.getText();c=psw2.getText();dispose();//关闭窗口System.exit(0);//退出程序}}图SEQ图\*ARABIC11用户登录界面代码如下:publicclassAdminLoginextendsJFrameimplementsActionListener{databasedatalink;JTextFieldinput1;JPasswordFieldinput2;JLabelprompt1;JLabelprompt2;JButtonok;publicAdminLogin(){ super("管理员登陆"); setSize(400,100); Dimensionsize=Toolkit.getDefaultToolkit().getScreenSize();setLocation((size.width-getWidth())/2,(size.height-getHeight())/2); setLayout(newFlowLayout()); prompt1=newJLabel("账号:"); prompt2=newJLabel(" 密码:"); input1=newJTextField(8); input2=newJPasswordField(8); ok=newJButton("确定"); ok.setSize(50,100);ok.addActionListener(this); add(prompt1); add(input1); add(prompt2); add(input2); add(ok); datalink=newdatabase(); setVisible(true);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==ok){if(input1.getText().length()==0||input2.getText().length()==0){ JOptionPane.showMessageDialog(this,"请输入用户名或密码!","提示错误",JOptionPane.ERROR_MESSAGE); }else{try{booleanb=true;Connectioncon=datalink.getCon();Statementstm=datalink.getStm();ResultSetrs=stm.executeQuery("SELECT*FROMadmin_info");if(rootPaneCheckingEnabled){while(rs.next()){Stringus=input1.getText();Stringps=input2.getText();if(us.equals(rs.getString("admtor"))&&ps.equals(rs.getString("admpsw"))){newManager();this.dispose();b=false;}InetAddressaddress=InetAddress.getLocalHost();StringIP_name=address.getHostAddress();CalendarE=Calendar.getInstance();intyear=E.get(Calendar.YEAR);intmonth=E.get(Calendar.MONTH)+1;intday=E.get(Calendar.DAY_OF_MONTH);inthour=E.get(Calendar.HOUR_OF_DAY);FileWriterout;out=newFileWriter("D:\\Adminfile.txt");out=newFileWriter("D:\\Adminfile.txt");out.write("登陆用户:"+input1.getText()+"密码:"+ps+"登陆时间"+year+"-"+month+"-"+day+""+hour+"IP:"+IP_name);out.close();}if(b){JOptionPane.showMessageDialog(this,"请输入正确的用户名或密码!","提示错误",JOptionPane.ERROR_MESSAGE); }//con.close();}}catch(IOExceptionex){Logger.getLogger(Login.class.getName()).log(Level.SEVERE,null,ex);}catch(SQLExceptionex){Logger.getLogger(AdminLogin.class.getName()).log(Level.SEVERE,null,ex);}}}}publicstaticvoidmain(String[]args){newAdminLogin();}}图SEQ图\*ARABIC12按班次查询航班图SEQ图\*ARABIC13按终始站查询图12和图13代码如下:publicclassFTableextendsAbstractTableModel{privateObject[][]data;privateString[]head={"航班号","航班公司","始发站","终点站","最大乘客数","现有乘客数","起飞时间","普通舱","商务舱"};publicFTable(List<ticktInfo>list){data=newObject[list.size()][];for(inti=0;i<list.size();i++){ticktInfof=list.get(i);data[i]=newObject[]{f.getFlightID(),f.getCompany(),f.getSstation(),f.getEstation(),getStartTime(),f.getMax(),f.getCurrent(),f.getPutongcang(),f.getShangwucang()};}}publicintgetColumnCount(){returnhead.length;}publicintgetRowCount(){returndata.length;}publicStringgetColumnName(intcol){returnhead[col];}publicObjectgetValueAt(introw,intcol){returndata[row][col];}publicClassgetColumnClass(intc){returngetValueAt(0,c).getClass();}}图SEQ图\*ARABIC14添加航班代码如下:publicclassAddFextendsJFrameimplementsActionListener{String[]title={"航班号","航班公司","起飞地点","到达地点","起飞时间","最大乘客数","现有乘客数","普通舱","商务舱"};JTextFieldtxt1=newJTextField(20);JTextFieldtxt2=newJTextField(20);JTextFieldtxt3=newJTextField(20);JTextFieldtxt4=newJTextField(20);JTextFieldtxt5=newJTextField(20);JTextFieldtxt6=newJTextField(10);JTextFieldtxt7=newJTextField(10);JTextFieldtxt8=newJTextField(10);JTextFieldtxt9=newJTextField(10);JButtonOK=newJButton("保存");JButtonCancel=newJButton("取消");ticktInfoflight;ArrayListplst=null;booleansuccess;publicAddF(){Dimensionsize=Toolkit.getDefaultToolkit().getScreenSize();setLocation((size.width-getWidth())/3,(size.height-getHeight())/3);Containercon=getContentPane();con.setLayout(newGridLayout(9,1));JPanelp[]=newJPanel[9];for(inti=0;i<9;i++){p[i]=newJPanel(newFlowLayout(FlowLayout.LEFT));p[i].add(newJLabel(title[i]+":"));}p[0].add(txt1);p[1].add(txt2);p[2].add(txt3);p[3].add(txt4);p[4].add(txt5);p[5].add(txt6);p[6].add(txt7);p[7].add(txt8);p[8].add(txt9);for(inti=0;i<9;i++){con.add(p[i]);}JPanelbottom=newJPanel();bottom.add(OK);bottom.add(Cancel);con.add(bottom);OK.addActionListener(this);Cancel.addActionListener(this);setTitle("航班信息添加窗口");setSize(800,500);setVisible(true);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==OK){Stringa=txt1.getText();Stringb=txt2.getText();Stringc=txt3.getText();Stringd=txt4.getText();Stringe1=txt5.getText();Stringf=txt6.getText();Stringg=txt7.getText();Stringh=txt8.getText();Stringj=txt9.getText();Solution.AddFlight(a,b,c,d,e1,f,g,h,j);dispose();}elseif(e.getSource()==Cancel){dispose();}}publicstaticvoidmain(String[]args){newAddF();}}图SEQ图\*ARABIC15删除航班代码如下:publicclassDeletFextendsJFrameimplementsActionListener{String[]title={"航班号","航班公司","起飞地点","到达地点","起飞时间","最大乘客数","现有乘客数","普通舱","商务舱"};JTextFieldtxt1=newJTextField(20);JTextFieldtxt2=newJTextField(20);JTextFieldtxt3=newJTextField(20);JTextFieldtxt4=newJTextField(20);JTextFieldtxt5=newJTextField(20);JTextFieldtxt6=newJTextField(10);JTextFieldtxt7=newJTextField(10);JTextFieldtxt8=newJTextField(10);JTextFieldtxt9=newJTextField(10);JButtonOK=newJButton("保存");JButtonCancel=newJButton("取消");ticktInfoflight;ArrayListplst=null;booleansuccess;publicAddF(){Dimensionsize=Toolkit.getDefaultToolkit().getScreenSize();setLocation((size.width-getWidth());Containercon=getContentPane();con.setLayout(newGridLayout(9,1));JPanelp[]=newJPanel[9];for(inti=0;i<9;i++){p[i]=newJPanel(newFlowLayout(FlowLayout.LEFT));p[i].delete(newJLabel(title[i]+":"));}p[0].delete(txt1);p[1].delete(txt2);p[2].delete(txt3);p[3].delete(txt4);p[4].delelte(txt5);p[5].delete(txt6);for(inti=0;i<6;i++){con.add(p[i]);}JPanelbottom=newJPanel();bottom.delete(OK);bottom.delete(Cancel);con.delete(bottom);OK.deleteActionListener(this);Cancel.deleteActionListener(this);setTitle("航班信息删除窗口:”);setVisible(true);setSize(800,500);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==OK){Stringa=txt1.getText();Stringb=txt2.getText();Stringc=txt3.getText();Stringd=txt4.getText();Stringe1=txt5.getText();Stringf=txt6.getText();Stringg=txt7.getText();Stringh=txt8.getText();Stringj=txt9.getText();Solution.AddFlight(a,b,c,d,e1,f,g,h,j);dispose();}elseif(e.getSource()==Cancel){dispose();}}publicstaticvoidmain(String[]args){ newdeleteF();}}图SEQ图\*ARABIC16乘客购票信息图SEQ图\*ARABIC17购票成功代码如下:classClientInfoextendsJFrameimplementsActionListener{Stringtitle[]={"航班号","起点","终点","起飞日期","姓名","身份证","联系电话","邮箱","座位号","购买票数"};JTextFieldtxtFid=newJTextField(10);JTextFieldtxtStart=newJTextField(10);JTextFieldtxtEnd=newJTextField(10);JTextFieldtxtTime=newJTextField(10);JTextFieldtxtName=newJTextField(10);JTextFieldtxtID=newJTextField(20);JTextFieldtxtTelNum=newJTextField(20);JTextFieldtxtEmail=newJTextField(20);JTextFieldtxtSeatNum=newJTextField(10);JTextFieldtxtCount=newJTextField(10);JButtonbtnOK=newJButton("确定");JButtonbtnCancel=newJButton("取消");publicClientInfo(){Containercon=getContentPane();con.setLayout(newGridLayout(11,1));JPanelp[]=newJPanel[10];for(inti=0;i<10;i++){p[i]=newJPanel(newFlowLayout(FlowLayout.LEFT));p[i].add(newJLabel(title[i]+":"));}p[0].add(txtFid);p[1].add(txtStart);p[2].add(txtEnd);p[3].add(txtTime);p[4].add(txtName);p[5].add(txtID);p[6].add(txtTelNum);p[7].add(txtEmail);p[8].add(txtSeatNum);p[9].add(txtCount);for(inti=0;i<10;i++){con.add(p[i]);}JPanelbottom=newJPanel();bottom.add(btnOK);bottom.add(btnCancel);con.add(bottom);btnOK.addActionListener(this);btnCancel.addActionListener(this);Dimensionsize=Toolkit.getDefaultToolkit().getScreenSize();setLocation((size.width-getWidth());setTitle("乘客订票信息填写窗口");setSize(450,600);setVisible(true);}publicvoidactionPerformed(ActionEvente){if(e.getSource()==btnOK){try{Stringa=txtName.getText();Stringb=txtID.getText();Stringc=txtTelNum.getText();Stringd=txtEmail.getText();Stringe1=txtSeatNum.getText();Stringf=txtFid.getText();Stringg=txtStart.getText();Stringh=txtEnd.getText();Stringi=txtTime.getText();Solution.AddClientInfo(a,b,c,d,e1,f,g,h,i);databaselink=newdatabase();Connectioncon=link.getCon();Statementstm=link.getStm();Stringsql="selectmax,currentfromflight_infowhereflightID="+"'"+txtFid.getText().trim()+"'"+"";try{intmax=0,cur=0;intudrem=0; ResultSetrs=stm.executeQuery(sql); Strings1=txtFid.getText().trim(); intct=Integer.parseInt(txtCount.getText().trim());while(rs.next()){max=rs.getInt("max");cur=rs.getInt("current");}if(cur>0){if(cur-ct>0){udrem=cur-ct;Stringstr1="updateflight_infosetmax="+"'"+max+"'"+",current="+"'"+udrem+"'"+"whereflightID="+"'"+s1+"'"+"";stm.executeUpdate(str1);JOptionPane.showConfirmDialog(this,"订票成功","购票提示",JOptionPane.YES_NO_OPTION);dispose();}else{udrem=cur-ct;JOptionPane.showConfirmDialog(this,"剩余票数为:"+String.valueOf(udrem)+"张","购票提示",JOptionPane.YES_NO_OPTION);}}else{JOptionPane.showConfirmDialog(this,"票已售完","提示错误",JOptionPane.YES_NO_OPTION);}con.close();dispose();}catch(Exceptionex){JOptionPane.showConfirmDialog(this,"订票失败","购票提示",JOptionPane.YES_NO_OPTION);}}catch(Exceptionex){}}elseif(e.getSource()==btnCancel){dispose();}}publicstaticvoidmain(String[]args){newClientInfo();}}图SEQ图\*ARABIC18退出系统代码如下:publicclassLoginextendsJFrameimplementsActionListener{JTextFielduser;JPasswordFieldpsw;JLabela,b;publicLogin(Strings){ super(s); cno.addActionListener(this); cno.setBounds(230,180,60,30); add(a); add(user); add(b); add(psw); add(cfg); add(cno); setLayout(null); setBounds(200,200,430,280); setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE); setResizable(false); setVisible(true); }publicvoidactionPerformed(ActionEvente){ if(e.getSource()==cno) { newRegister();this.dispose(); } }publicstaticvoidmain(Stringargs[]){ newLogin("用户退出");}参考文献:[1]《信息系统分析与设计》,陈禹主编,杨善林梁昌勇左美云副主编高等教育出版社,2005.[2]《信息系统开发方法教程》,陈佳主编,清华大学出版社,1999.[3]《信息系统设计原理与应用》,刘鲁,北京航空航天大学出版社,1995.[4]《企业管理信息系统开发的理论和方法》,葛世伦,代逸生,清华出版社,1996年(中文著作).[5]《java案例开发集锦(第二版)》,袁然,郑自国,来为国,电子工业出版社,2008年[6]闫建红.基于UML的机票预定系统的开发研究[J].太原师范学院学报(自然科学版),2005,(03).基于C8051F单片机直流电动机反馈控制系统的设计与研究基于单片机的嵌入式Web服务器的研究MOTOROLA单片机MC68HC(8)05PV8/A内嵌EEPROM的工艺和制程方法及对良率的影响研究基于模糊控制的电阻钎焊单片机温度控制系统的研制基于MCS-51系列单片机的通用控制模块的研究基于单片机实现的供暖系统最佳启停自校正(STR)调节器单片机控制的二级倒立摆系统的研究基于增强型51系列单片机的TCP/IP协议栈的实现基于单片机的蓄电池自动监测系统基于32位嵌入式单片机系统的图像采集与处理技术的研究基于单片机的作物营养诊断专家系统的研究基于单片机的交流伺服电机运动控制系统研究与开发基于单片机的泵管内壁硬度测试仪的研制基于单片机的自动找平控制系统研究基于C8051F040单片机的嵌入式系统开发基于单片机的液压动力系统状态监测仪开发模糊Smith智能控制方法的研究及其单片机实现一种基于单片机的轴快流CO〈,2〉激光器的手持控制面板的研制基于双单片机冲床数控系统的研究基于CYGNAL单片机的在线间歇式浊度仪的研制基于单片机的喷油泵试验台控制器的研制基于单片机的软起动器的研究和设计基于单片机控制的高速快走丝电火花线切割机床短循环走丝方式研究基于单片机的机电产品控制系统开发基于PIC单片机的智能手机充电器基于单片机的实时内核设计及其应用研究基于单片机的远程抄表系统的设计与研究基于单片机的烟气二氧化硫浓度检测仪的研制基于微型光谱仪的单片机系统单片机系统软件构件开发的技术研究基于单片机的液体点滴速度自动检测仪的研制基于单片机系统的多功能温度测量仪的研制基于PIC单片机的电能采集终端的设计和应用基于单片机的光纤光栅解调仪的研制气压式线性摩擦焊机单片机控制系统的研制基于单片机的数字磁通门传感器基于单片机的旋转变压器-数字转换器的研究基于单片机的光纤Bragg光栅解调系统的研究单片机控制的便携式多功能乳腺治疗仪的研制基于C8051F020单片机的多生理信号检测仪基于单片机的电机运动控制系统设计Pico专用单片机核的可测性设计研究基于MCS-51单片机的热量计基于双单片机的智能遥测微型气象站MCS-51单片机构建机器人的实践研究基于单片机的轮轨力检测基于单片机的GPS定位仪的研究与实现基于单片机的电液伺服控制系统用于单片机

温馨提示

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

评论

0/150

提交评论