酒店管理系统4905423727

整理文档很辛苦,赏杯茶钱您下走!

免费阅读已结束,点击下载阅读编辑剩下 ...

阅读已结束,您可以下载文档离线阅读编辑

资源描述

自选题目设计一:酒店管理系统程序代码1.数据库的实现创建系统用户表格RoomtypecreatedatabasehotelgousehotelgoCREATETABLERoomtype(TypeidVarchar(10)primarykey,TypenameVarchar(16),BednumSMALLINT,PriceINT,)insertintoRoomtypevalues('LX0001','标准单人间',1,100)insertintoRoomtypevalues('LX0002','标准双人间',2,160)insertintoRoomtypevalues('LX0003','豪华单人间',1,200)insertintoRoomtypevalues('LX0004','豪华双人间',2,360)insertintoRoomtypevalues('LX0005','商务套房',1,1000)insertintoRoomtypevalues('LX0006','总统套房',2,2000)创建客房信息表格RoomsCREATETABLERooms(RoomNOVarchar(10)primarykey,TypeidVarchar(10)NOTNULL,RoompositionVarchar(5)NULL,PutupVarchar(5)NOTNULL,FOREIGNKEY(Typeid)REFERENCESRoomtype(Typeid))2.登录功能实现该模块只要是为了方便酒店管理员的操作,界面友好,简单易操作。需要有一定的美观性和可操作性。同时为了保证安全性,我们设定了权限功能,管理员可以使用全部功能,而普通用户不能使用系统管理功能,所以普通用户不能增减客房信息,同时,也不能增减系统的用户。图4主界面主代码如下packageUI;importjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjava.util.*;importUI.*;publicclassmainFrameextendsJFrame{privateJButtonbt1,bt2,bt3,bt4,bt5;privateJTextFieldtf1,tf2;privateintwholepart;publicmainFrame(){super(金翎酒店欢迎您!);JPanelpanelMain,panelCent,panelNort,panelBottom;panelMain=newJPanel(newBorderLayout());panelNort=buildNorth();panelCent=buildDTM();panelMain.add(panelNort,BorderLayout.NORTH);panelMain.add(panelCent);setContentPane(panelMain);setSize(780,620);setVisible(true);}privateJPanelbuildNorth(){JPanelpanelNort1=newJPanel();Iconbug1=newImageIcon(pic/m01.gif);Iconbug2=newImageIcon(pic/m04.gif);Iconbug3=newImageIcon(pic/m05.gif);Iconbug4=newImageIcon(pic/m06.gif);Iconbug5=newImageIcon(pic/m07.gif);bt1=newJButton(客户预定,bug3);bt2=newJButton(入住登记,bug2);bt3=newJButton(客户结账,bug1);bt4=newJButton(营业查询,bug4);bt5=newJButton(系统管理,bug5);panelNort1.add(bt1);panelNort1.add(bt2);panelNort1.add(bt3);panelNort1.add(bt4);panelNort1.add(bt5);Buttonhandlerhandler=newButtonhandler();bt1.addActionListener(handler);bt2.addActionListener(handler);bt3.addActionListener(handler);bt4.addActionListener(handler);bt5.addActionListener(handler);returnpanelNort1;}privateJPanelbuildDTM(){JPanelpanelCent1=newJPanel(newBorderLayout());tf1=newJTextField(20);tf1.setForeground(Color.yellow);tf1.setBackground(Color.red);tf1.setText(金翎酒店欢迎您!);tf1.setFont(newFont(楷体,Font.BOLD,20));tf1.setHorizontalAlignment(JTextField.CENTER);tf1.setBorder(newLineBorder(newColor(87,87,47)));tf1.setEditable(false);panelCent1.add(North,tf1);JPanelpanelBottom1=newJPanel(newBorderLayout());finalImageIconimageIcon=newImageIcon(pic/jiudian.jpg);JPanelp=newJPanel(){//获取图片Imageimage=imageIcon.getImage();publicvoidpaint(Graphicsg){//绘制图片g.drawImage(image,0,0,this.getWidth(),this.getHeight(),this);}}JScrollPanescrollPane=newJScrollPane(p);panelBottom1.add(panelCent1,BorderLayout.NORTH);panelBottom1.add(scrollPane,BorderLayout.CENTER);returnpanelBottom1;}publicvoidsetwholepart(inta){wholepart=a;}privateclassButtonhandlerimplementsActionListener{publicvoidactionPerformed(ActionEventevent){Objecto=event.getSource();if(o==bt1){newEngage();//客户预定}elseif(o==bt2){newCustomer();//入住登记}elseif(o==bt3){newaccount();//客户结账}elseif(o==bt4){newquarryBussiness();//营业查询}elseif(o==bt5){if(wholepart==0)JOptionPane.showMessageDialog(null,金翎酒店提示您\n非管理员无此权限!);elsenewsystemManager();//系统管理}}}publicstaticvoidmain(Stringargs[]){mainFrameapplication=newmainFrame();application.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);}}3.预定功能实现此模块主要实现客户的预定功能,包括查询、增加、删除预订信息,并能查询剩余的客房,以便于实现预定功能。图8客户预定主界面主代码:packageUI;importjavax.swing.*;importjava.awt.*;importjava.awt.event.*;importjava.sql.*;importjava.util.*;importUI.*;publicclassEngageextendsJFrame{privateJButtonbt1,bt2,bt3,bt4;privateJTextFieldtf1;publicEngage(){super(金翎酒店客户预订);JPanelpanelMain,panelCent,panelNort;panelMain=newJPanel(newBorderLayout());panelNort=buildNorth();panelCent=buildDTM();panelMain.add(North,panelNort);panelMain.add(panelCent);setContentPane(panelMain);setSize(500,130);setResizable(false);//不允许改变窗口大小setVisible(true);}privateJPanelbuildNorth(){JPanelpanelCent1=newJPanel(newBorderLayout());tf1=newJTextField(宾客预定信息);tf1.setFont(newFont(楷体,Font.BOLD,15));tf1.setHorizontalAlignment(JTextField.CENTER);tf1.setForeground(Color.yellow);tf1.setBackground(Color.red);tf1.setBorder(newLineBorder(newColor(87,87,47)));tf1.setEditable(false);panelCent1.add(North,tf1);panelCent1.setBorder(BorderFactory.createTitledBorder());returnpanelCent1;}privateJPanelbuildDTM(){JPanelpanelNort1=newJPanel();Iconbug1=newImageIcon(pic/new.gif);Iconbug2=newImageIcon(pic/del.gif);Iconbug3=newImageIcon(pic/find.gif);bt1=newJButton(增加,bug1);bt3=newJButton(删除,bug2);bt2=newJButton(查询预定信息,bug3);bt4=newJButton(查询客房信息,bug3);panelNort1.add(bt1);panelNort1.add(bt3);panelNort1.add(bt2);panelNort1.add(bt4);Buttonhandlerhandler=newButtonhandler();bt1.addActionListener(handler);bt2.addActionListener(handler);bt3.addActionListener(handler);bt4.addActionListener(handler);returnpanelNort1;}privateclassButtonhandlerimplementsActionListener{publicvoidactionPerformed(ActionEventevent){Objecto=event.getSource();if(o==bt1){addEngageadd=newaddEngage();}elseif(o==bt3){deleteEngagedelete=newdeleteEngage();}else

1 / 20
下载文档,编辑使用

©2015-2020 m.777doc.com 三七文档.

备案号:鲁ICP备2024069028号-1 客服联系 QQ:2149211541

×
保存成功