酒店管理系统源代码

合集下载

酒店管理系统代码(C语言版)

酒店管理系统代码(C语言版)

#include <stdio.h〉#include 〈stdlib。

h>#include <string。

h>//房间信息结构体struct Node{int Count; //指示该房间有多少个房客char nameOne[20]; //房客1的名字char nameTwo[20]; //房客2的名字int sexOne;//房客1的性别—1代表女,0代表没有,1代表男int sexTwo; //房客2的性别int roomNumber;//房间号}roomArray[5];//初始化房间数组void InitArray(){int i;for(i=0;i<5;i++){roomArray[i].roomNumber = 301+i;memset(roomArray[i]。

nameOne,0,20);memset(roomArray[i]。

nameTwo,0,20);roomArray[i].sexOne = 0;roomArray[i].sexTwo = 0;roomArray[i].Count = 0;}}void fun1() //旅客入住的操作{char name[20];int sex;int i;printf(”\n输入入住旅客姓名和性别(空格隔开,1为男,—1为女):”);scanf(”%s %d",name,&sex);for(i=0;i<5;i++){if(roomArray[i]。

Count == 2){continue;}else if(roomArray[i].Count == 1){if(roomArray[i]。

sexOne != sex){continue;}strcpy(roomArray[i].nameTwo,name);roomArray[i].sexTwo = sex;roomArray[i]。

Count++;system("cls”);printf("客人已经成功入住,在房间%d”,roomArray[i].roomNumber);return;;}else{strcpy(roomArray[i]。

酒店管理系统实现代码

酒店管理系统实现代码

//入住import java。

awt。

*;import java。

awt.event.*;import javax.swing.*;import javax.swing.border。

Border;import javax。

swing。

text。

*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame ("入住系统”);JLabel nameLabel = new JLabel(”客户姓名”);JLabel idtifyLabel = new JLabel(”身份证号”);JLabel roomLabel = new JLabel("入住房号");JLabel moneyLabel = new JLabel("应付金额");JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();JButton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField。

setDocument(ucDocument);nameField.setForeground(Color。

black);//frame.addWindowListener(this);nameField.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){String username = nameField.getText();}});JComboBox jcb1;//组合框String[]itemList = { "现金",”刷卡”};jcb1 = new JComboBox(itemList);jcb1.setSelectedIndex(0);button1=new JButton("确认支付”);button2=new JButton(”取消支付”);final JPanel p1 = new JPanel();p1。

酒店管理系统代码

酒店管理系统代码

#include <windows.h〉#include <dos。

h>#include〈stdio.h〉#include〈stdlib。

h〉#include<time。

h〉//—-—-—-—-——--———---------————--—---—---—--——-———-——结构定义-————-—-——-----—--———-—-—-—--—-—--—————-—-typedef struct CheckinInformation{char name[10];//姓名int id;//证件号int roomType;//房型int countType;//计费方式}CheckinInfo;typedef struct HotelRoom{int roomType;//房型int roomNum;//房号int checked; //入住情况int price;//房价}Room;typedef struct RoomOrder{CheckinInfo *checkinInfo;//入住信息long date; //入住时间Room *room; //房间信息}Order;typedef struct HotelInfomation{int checkinAmount; //已入住房数int singleRemainAmount;//单人房剩余房数int doubleRemainAmount; //双人房剩余房数int bigRemainAmount; //大床房剩余房数}HotelInfo;//-—-—-——---————----—--——--——-—-——枚举类型——-—-——------—-———-—-—-——--enum {MainUI,HotelInfoUI,CheckinUI,CheckinResultUI,OrderUI,CheckOutUI,Exit};//GUI enum {Single,Double,Big};//Room Typeenum {Hour,Day};//countType//--——---—————--————-—--—---——-———全局变量-----—--———-—-—-—-——-—-——-int GUI = MainUI;Order*orderList[100];//订单数组Room* roomList[100];//房间数组HotelInfo * hotelInfo = NULL;//酒店房间信息//—————--—-—--——---——-—--—--——-——函数声明———--—-—--——--—————-——---——-void initiallizeRoomList();void insertToOrderList(Order * order);Room* getRoomByType(int roomType);Order*getOrderByRoomNum(int roomNum);void showMainUI();void showHotelInfoUI();void showCheckinUI();void showCheckinResultUI();void showOrderUI();void showCheckOutUI();//-——-—-——-—————--——---—-—————-——Main函数—--———-————-—-——-——---—--—--void main() //主函数{//初始化酒店房间信息hotelInfo = (HotelInfo *)malloc(sizeof(HotelInfo));hotelInfo -〉singleRemainAmount = 20;hotelInfo -〉doubleRemainAmount=40;hotelInfo -〉bigRemainAmount=40;hotelInfo -〉checkinAmount=0;//初始化房间列表initiallizeRoomList();//界面显示while(GUI != Exit){switch(GUI){case MainUI:showMainUI();break;case HotelInfoUI:showHotelInfoUI();break;case CheckinUI:showCheckinUI();break;case CheckinResultUI:showCheckinResultUI();break;case OrderUI:showOrderUI();break;case CheckOutUI:showCheckOutUI();break;default:break;}}}//-——---———-—--—-————-—--——-—————函数定义-——---——-—-—--—---—-———---——void initiallizeRoomList(){//房间数组初始化,初始化的结果是让roomList的数组有100个room指针,而且设置了相应的值int i;Room*newRoom=NULL;for(i=0;i<20;i++) //单人房房间信息初始化{newRoom = ( Room* )malloc(sizeof(Room));roomList[i]= newRoom;roomList[i]-〉checked=0;roomList[i]—〉price=110;roomList[i]—>roomNum=i+1;roomList[i]—>roomType=Single;}for(i=20;i<60;i++) //双人房房间信息初始化{newRoom = ( Room* )malloc(sizeof(Room));roomList[i] = newRoom;roomList[i]->checked=0;roomList[i]->price=180;roomList[i]—>roomNum=i+1;roomList[i]->roomType=Double;}for(i=60;i〈100;i++)//大床房房间信息初始化{newRoom = ( Room* )malloc(sizeof(Room));roomList[i] = newRoom;roomList[i]-〉checked=0;roomList[i]-〉price=180;roomList[i]-〉roomNum=i+1;roomList[i]—>roomType=Big;}}//通过所选择的房型获取空房间,获取房间后将房间信息改为已入住,并减少相应房型的剩余房间数Room*getRoomByType(int roomType){int i;switch(roomType){case Single:for(i=0;i〈20;i++){if(roomList[i]-〉checked == 0){roomList[i]->checked=1;hotelInfo—>singleRemainAmount -- ;hotelInfo-〉checkinAmount++;return roomList[i];}}break;case Double:for(i=20;i<60;i++){if( roomList[i]-〉checked == 0){roomList[i]—〉checked=1;hotelInfo—〉doubleRemainAmount —— ;hotelInfo—〉checkinAmount++;return roomList[i];}}break;case Big:for(i=60;i<100;i++){if(roomList[i]—>checked == 0){roomList[i]—〉checked=1;hotelInfo-〉bigRemainAmount --;hotelInfo—〉checkinAmount++;return roomList[i];}}break;}}//将订单放入订单列表void insertToOrderList(Order * order){int i;for( i = 0;i<100;i++){if( orderList[i] ==NULL ){orderList[i] = order;break;}}}//通过房号查询订单Order*getOrderByRoomNum(int roomNum){int i;for(i=0;i<100;i++){if(orderList[i]->room->roomNum == roomNum){return orderList[i];}}}void showMainUI(){//显示主界面,并接受输入int chooseNum;system(”cls");printf(”\n\n==========================酒店房间登记与计费管理管理系统=======================\t\n\n\n”);printf(”*\t\t\t\t1。

酒店管理系统实现代码

酒店管理系统实现代码

//入住import java.awt.*;import java。

awt。

event.*;import javax。

swing。

*;import javax.swing。

border.Border;import javax.swing。

text.*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame ("入住系统”);JLabel nameLabel = new JLabel(”客户姓名");JLabel idtifyLabel = new JLabel(”身份证号”);JLabel roomLabel = new JLabel("入住房号”);JLabel moneyLabel = new JLabel("应付金额”);JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();JButton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1。

go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);//frame.addWindowListener(this);nameField。

酒店管理系统实现代码

酒店管理系统实现代码

//入住import java.awt.*;import java.awt.event。

*;import javax.swing.*;import javax.swing。

border。

Border;import javax。

swing.text。

*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame (”入住系统”);JLabel nameLabel = new JLabel("客户姓名");JLabel idtifyLabel = new JLabel("身份证号”);JLabel roomLabel = new JLabel("入住房号");JLabel moneyLabel = new JLabel(”应付金额”);JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();JButton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1。

go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField。

setDocument(ucDocument);nameField。

setForeground(Color.black);//frame。

酒店管理系统源代码

酒店管理系统源代码

西彼科技有限责任公司参考源码酒店管理系统彼岸2011-03-31本段源代码,参考与阳光酒店管理系统编写的系统包Sunsdk包1)System包CsHashtable.java/** @(#)CsHashtable.java 1.24 03/12/19** public class** Copyright 2006 CazoSoft, Inc. All rights reserved.*/package sunsdk.system;import java.util.*;/*** <code> CsHashtable </code>* <p>* 该类的作用是封装哈希表* <p>* <strong>注意: </strong> 本类使用的哈希表方法put, 可能存在不安全因素* <p>* 相关类:Hashtable** @author 鲜强* @version 2006.3.28 22:18* @see java.util.Hashtable* @since CAZOSOFT 1.0*/public class CsHashtable {/*** 静态变量功能: 构造一个hashtable 供其他函数使用*/private static Hashtable hTable = new Hashtable();/*** 构造函数功能: 构造函数为静态的不能创建对象*/private CsHashtable() {}/*** 放入对象函数功能: 把对象放入哈希表,对象为Object类型** @param key :* 键值, Object 对象* @param value :* 对象, Object 对象*/public static void put(Object key, Object value) {hTable.put(key, value);}/*** 返回对象函数功能: 从哈希表中取出对象,返回为Object类型** @param key :* 键值* @return : 一个Object 对象*/public static Object get(Object key) {return hTable.get(key);}/*** 返回大小函数功能: 返回哈希表的大小** @return : 一个int 哈希表长度值*/public static int size() {return hTable.size();}/*** 移除一个对象** @param key : 接受一个要移除的键值*/public static Object remove(Object key) {return hTable.remove(key);}}/**Sunini.java*############################################################################## ** [ 项目名] :* [ 公司名] : SunshineSOFT* [ 模块名] : 对于INI文件的相关操作* [ 文件名] : sunini.java* [ 相关文件] : config.ini* [ 文件实现功能] : 读取和保存INI文件* [ 作者] : 顾俊* [ 版本] : 1.1* ----------------------------------------------------------------------------* [ 备注] :* ----------------------------------------------------------------------------* [ 修改记录] :** [ 日期] [版本] [修改人] [修改内容]* 2006/03/31 1.0 顾俊创建* 2006/04/06 1.1 顾俊修改读取函数* ##--------------------------------------------------------------------------* 版权所有(c) 2006-2007, SunshineSOFT Corporation* --------------------------------------------------------------------------##** [ 函数说明] :** [## private sunini() {} ]:* 功能: 构造函数** [## public static String getIniKey (String k) {} ]:* 功能: 获得INI文件中的指定键的键值** [## public static void setIniKey (String k, String v) {} ]:* 功能: 设置k键的键值为v对象** [## public static void saveIni (String k[]) {} ]:* 功能: 将k字符数组中所有键所对应的键值保存到INI文件中** [ 遗留问题] : setIniKey ()方法不能处理键值中的转义字符**############################################################################## */package com.sunshine.sunsdk.system;import java.util.*;import java.io.*;public class sunini {private static Properties ini = null;static {try {ini = new Properties ();ini.load (new FileInputStream ("config.ini"));}catch (Exception ex) {System.out.println ("Load CONFIG.INI is false!!");}//End try}/**=======================================================================* ** [## private sunini() {} ]: 构造函数* 参数:无* 返回值:无* 修饰符:private* 功能:防止实例化sunini对象**=======================================================================** */private sunini() {}/**=======================================================================* ** [## public static String getIniKey (String k) {} ]:* 参数:String对象表示键* 返回值:String对象表示k键所对应的键值,如果失败则返回空串* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:获得INI文件中的指定键的键值**=======================================================================** */public static String getIniKey (String k) {if(!ini.containsKey (k)) { //是否有k 这个键System.out.println ("The [ " + k + " ] Key is not exist!!");return "";}//End if(!ini.containsKey (k))return ini.get (k).toString ();}/**=======================================================================* ** [## public static void setIniKey (String k, String v) {} ]:* 参数:String k对象表示键,String v对象表示键值* 返回值:无* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:设置k键的键值为v对象**=======================================================================** */public static void setIniKey (String k, String v) {if(!ini.containsKey (k)) { //是否有k 这个键System.out.println ("The [ " + k + " ] Key is not exist!!");return;}//End if(!ini.containsKey (k))ini.put (k, v);}/**=======================================================================* ** [## public static void saveIni (String k[]) {} ]:* 参数:String k[]字符串数组表示要保存的所有键* 返回值:无* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:将k字符数组中所有键所对应的键值保存到INI文件中**=======================================================================** */public static void saveIni (String k[]) {try {FileWriter fw = new FileWriter ("config.ini");BufferedWriter bw = new BufferedWriter ( fw );//循环变量i是k字符串数组的下标for (int i = 0; i < k.length; i++) {bw.write (k[i] + "=" + getIniKey (k[i]));bw.newLine ();}//End forbw.close ();fw.close ();}catch (Exception ex) {System.out.println ("Save CONFIG.INI is false.");}//End try}}Suntools.java/***############################################################################## ** [ 项目名] :* [ 公司名] : SunshineSOFT* [ 模块名] : 工具函数* [ 文件名] : suntools.java* [ 相关文件] :* [ 文件实现功能] : 测试数据是否合法及流水号自动分配* [ 作者] : 顾俊* [ 版本] : 1.2* ----------------------------------------------------------------------------* [ 备注] :* ----------------------------------------------------------------------------* [ 修改记录] :** [ 日期] [版本] [修改人] [修改内容]* 2006/04/07 1.0 顾俊建立isDate()函数* 2006/04/08 1.1 顾俊添加函数#A, #B, #C, #D* 2006/04/08 1.2 顾俊添加函数#E, #F, #G* ##--------------------------------------------------------------------------* 版权所有(c) 2006-2007, SunshineSOFT Corporation* --------------------------------------------------------------------------##** [ 函数说明] :** [## private suntools () {} ] :* 功能: 防止实例化suntools对象** [## public static boolean isDate (String date) {} ]:* 功能: 判断日期字符串是否合法函数** [## public static boolean isNum (String in) {} ]: #A* 功能: 测试字符串是否由数字(0-9)组成** [## public static boolean isNum (String in, int length, double min, double max) {} ]: #B* 功能: 测试字符串表示的数值及范围,且字符串只能是数字组成** [## public static String getNumber (int type) {} ]: #C* 功能: 自动分配单据编号, 自动递增** [## public static void savNumber (String num, int type) {} ]: #D* 功能: 将已用编号保存到INI文件** [## public static double getConsumeFactor(String sDate, String eDate) {} ]: #E* 功能: 计算酒店计费天数按INI文件中设置的** [## public static double getClockFactor(String sDate, String eDate) {} ]: #F* 功能: 计算酒店钟点房计费系数按INI文件中设置的** [## public static String getConsumeHour(String sDate, String eDate) {} ]: #G* 功能: 计算两个时间之间有几小时几分*** [ 遗留问题] :***############################################################################## */package com.sunshine.sunsdk.system;import java.util.*;import java.text.*;import java.sql.*;import com.sunshine.sunsdk.sql.*;public class suntools {public static final int Number_RZ = 0; //表示销售单号public static final int Number_YD = 1; //表示进货单号public static final int Number_JS = 1; //表示进货单号/**=======================================================================* ** [## private suntools () {} ]: 构造函数* 参数:无* 返回值:无* 修饰符:private* 功能:防止实例化suntools对象**=======================================================================** */private suntools () {}/**=======================================================================* ** [## public static boolean isDate (String date) {} ]:* 参数:String对象表示日期的字符串* 返回值:boolean 合法返回true* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:判断日期字符串是否合法函数**=======================================================================** */public static boolean isDate (String date) {SimpleDateFormat sdf = new SimpleDateFormat ("yyyy-MM-dd hh:mm:ss");String isdate = date;if(date.length() == 10) //如果只有日期,函数自动加上00:00:00 isdate = date + " 00:00:00";try {sdf.parse (isdate);return true;}catch (Exception ex) {System.out.println ("feetools.isDate(): The DATE format is error .");return false;}}/**=======================================================================* ** [## public static boolean isNum (String in) {} ]:* 参数:String对象表示被测字符串* 返回值:boolean 合法返回true* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:测试字符串是否由数字(0-9)组成**=======================================================================** */public static boolean isNum (String in) {return isNum (in, 0, 0, 0);}/**=======================================================================* ** [## public static boolean isNum (String in, int length, double min, double max) {} ]:* 参数:String对象表示被测字符串* length变量表示字符串最大长度,取值0,表示没有长度限定* min,max变量限定了String对象表示的数值范围,当(length > 0)时* 返回值:boolean 合法返回true* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:测试字符串表示的数值及范围,且字符串只能是数字组成**=======================================================================** */public static boolean isNum (String in, int length, double min, double max) {String num = in;int point = 0; //'.'的个数int len = num.length ();if(length > 0) {if(len > length || len == 0) { //判断字符串长度,不合法空返回falseSystem.out.println ("suntools.isNum(): Length error.");return false;}//Endif}//End if(length > 0)elseif(len == 0) { //判断字符串是否为空,空返回falseSystem.out.println ("suntools.isNum(): String is NULL");return false;}//End if(len == 0)for (int i = len - 1; i >=0; i--) { //判断字符串只能是数字char ac = num.charAt (i);if(ac == '.' && point == 0 && i!= 0) { //如果是'.'字符,且是第一次出现,且不是只有一个点if(i > len - 4) { //判断小数位只能是两位point++;continue;}//Endif}//Endifif(ac < '0' || ac > '9' ) {System.out.println ("suntools.isNum(): Character isn't ( '0' - '9' )");return false;}//Endif}//Endforif(length !=0) {double s = Double.parseDouble (num); //现在len为字符串表示的数值if(s < min || s >max) { //限制范围min-max之间System.out.println ("suntools.isNum(): Amount limit error. ");return false;}//Endif}//End if(length != 0)return true;}/**=======================================================================* ** [## public static String getNumber (int type) {} ]:* 参数:int变量表示要获得什么类型的单号(见类头常量)* 返回值:String对象: 单号;* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:自动分配单据编号, 自动递增**=======================================================================** */public static String getNumber (int type) {GregorianCalendar gc = new GregorianCalendar();String tp, number, month, day; //单号标头, 单号记数位, 为月份, 为天int numLen = 0; //单号的默认位数if(type == Number_RZ) { //要获取销售单号tp = sunini.getIniKey ("LodgName");number = sunini.getIniKey ("LodgNumber");}else if(type == Number_YD){ //要获取进货单号tp = sunini.getIniKey ("EngaName");number = sunini.getIniKey ("EngaNumber");}else {tp = sunini.getIniKey ("ChouName");number = sunini.getIniKey ("ChouNumber");}numLen = number.length (); //得到单号的默认位数number = Integer.parseInt (number) + 1 + ""; //将单号增1,再转成字符串//判断记数号是否超位(超出要求长度)if(number.equals ((int)Math.pow (10, numLen - 1) + "") && number.length() > 1)number = number.substring(1); //单号记数位清零//for循环,用'0'为number补位(i = 当前号码位数, i < numLen)for (int i = number.length (); i < numLen; i++) {number = "0" + number;}//Endfor//为月份补'0'month = gc.get (GregorianCalendar.MONTH) + 1 + "";if( month.length() == 1)month = "0" + month;//为天补'0'day = gc.get (GregorianCalendar.DAY_OF_MONTH) + "";if( day.length () == 1)day = "0" + day;//连接单号标头,日期,记数位;组成单据号码tp = tp + gc.get (GregorianCalendar.YEAR) + month + day + number;return tp; //返回单号}/**=======================================================================* ** [## public static void savNumber (String num, int type) {} ]:* 参数:String对象表示要保存的单号* int变量表示要保存什么类型的单号(见类头常量)* 返回值:无* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:将已用编号保存到INI文件**=======================================================================** */public static void savNumber (String num, int type) {//INI文件中的键名String ini[] = { "[SOFTINFO]", "UserName", "CompName", "[CONFIG]", "Soft_First","Default_Link" , "Default_Page", "Sys_style", "[NUMBER]","LodgName", "LodgNumber", "EngaName", "EngaNumber", "ChouName","ChouNumber", "[HABITUS]", "Ck_Habitus", "Ck_Minute", "[PARTTIME]","In_Room", "Out_Room1", "Out_Room2", "InsuDay", "ClockRoom1","ClockRoom2", "InsuHour1", "InsuHour2", "[JDBC]", "DBFname","UserID", "Password", "IP", "Access", "[ODBC]", "LinkName" };String bt;if(type == Number_RZ) {bt = sunini.getIniKey ("LodgName");sunini.setIniKey ("LodgNumber", num.substring (bt.length () + 8));}else if(type == Number_YD){bt = sunini.getIniKey ("EngaName");sunini.setIniKey ("EngaNumber", num.substring (bt.length () + 8));} else{bt = sunini.getIniKey ("ChouName");sunini.setIniKey ("ChouNumber", num.substring (bt.length () + 8));}//保存到INI文件sunini.saveIni (ini);}/**=======================================================================* ** [## public static double getConsumeFactor(String sDate, String eDate) {} ]:* 参数:String sDate对象表示开始时间* String eDate变量表示结束时间* 返回值:double* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:计算酒店计费天数按INI文件中设置的**=======================================================================** *///获得消费系数public static double getConsumeFactor(String sDate, String eDate) {//获得开始日期时间的--年--月--日--时--分--秒String syh [] = sDate.trim ().split(" ");String symd[] = syh[0].trim().split("-");String shms[] = syh[1].trim().split(":");int sy = Integer.parseInt(symd[0]);int sM = Integer.parseInt(symd[1]);int sd = Integer.parseInt(symd[2]);int sh = Integer.parseInt(shms[0]);int sm = Integer.parseInt(shms[1]);int ss = Integer.parseInt(shms[2]);//获得结束日期时间的--年--月--日--时--分--秒String eyh [] = eDate.trim ().split(" ");String eymd[] = eyh[0].trim().split("-");String ehms[] = eyh[1].trim().split(":");int ey = Integer.parseInt(eymd[0]);int eM = Integer.parseInt(eymd[1]);int ed = Integer.parseInt(eymd[2]);int eh = Integer.parseInt(ehms[0]);int em = Integer.parseInt(ehms[1]);int es = Integer.parseInt(ehms[2]);//获得sDate的long值long sdt = new Timestamp(sy, sM, sd, sh, sm, ss, 0).getTime();//获得eDate的long值long edt = new Timestamp(ey, eM, ed, eh, em, es, 0).getTime();double db = 0;if(sdt > edt) { //不合法开始日期一定要小于结束日期db = -1;return db;}//Endifif(sdt == edt) { //无时间差db = 0;return db;}//Endifint insuDay = (int)(edt - sdt)/3600000;if(insuDay < 24) { //入住不到一天if(Integer.parseInt(sunini.getIniKey("InsuDay")) == 1)db = 1; //按全天计费else {if(insuDay > 1 && insuDay < 12)db = 0.5; //如果不按全天计费,则大于1小时按半天计费elsedb = 1; //如果不按全天计费,则大于12小时按全天计费}//Endifreturn db;}//Endif//几点之后按新的一天计费int inRoom = Integer.parseInt(sunini.getIniKey("In_Room"));if(sh < inRoom) {db = 0.5;}//Endifsh = inRoom; //多的时间已经加了系数,去掉多余的//几点之后按半天计费int outRoom1 = Integer.parseInt(sunini.getIniKey("Out_Room1"));int outRoom2 = Integer.parseInt(sunini.getIniKey("Out_Room2"));if(eh > outRoom1 && eh < outRoom2) {db = db + 0.5;eh = outRoom1; //多的时间已经加了系数,去掉多余的}else if(eh >= outRoom2) {db = db + 1;eh = outRoom2;}//Endif//计算入住时间sdt = new Timestamp(sy, sM, sd, sh, sm, ss, 0).getTime();edt = new Timestamp(ey, eM, ed, eh, em, es, 0).getTime();db = db + (edt - sdt)/86400000;return db;}/**=======================================================================* ** [## public static double getClockFactor(String sDate, String eDate) {} ]:* 参数:String sDate对象表示开始时间* String eDate变量表示结束时间* 返回值:double* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:计算酒店钟点房计费系数按INI文件中设置的**=======================================================================** */public static double getClockFactor(String sDate, String eDate) {//获得开始日期时间的--年--月--日--时--分--秒String syh [] = sDate.trim ().split(" ");String symd[] = syh[0].trim().split("-");String shms[] = syh[1].trim().split(":");int sy = Integer.parseInt(symd[0]);int sM = Integer.parseInt(symd[1]);int sd = Integer.parseInt(symd[2]);int sh = Integer.parseInt(shms[0]);int sm = Integer.parseInt(shms[1]);int ss = Integer.parseInt(shms[2]);//获得结束日期时间的--年--月--日--时--分--秒String eyh [] = eDate.trim ().split(" ");String eymd[] = eyh[0].trim().split("-");String ehms[] = eyh[1].trim().split(":");int ey = Integer.parseInt(eymd[0]);int eM = Integer.parseInt(eymd[1]);int ed = Integer.parseInt(eymd[2]);int eh = Integer.parseInt(ehms[0]);int em = Integer.parseInt(ehms[1]);int es = Integer.parseInt(ehms[2]);//获得sDate的long值long sdt = new Timestamp(sy, sM, sd, sh, sm, ss, 0).getTime();//获得eDate的long值long edt = new Timestamp(ey, eM, ed, eh, em, es, 0).getTime();//获得时间差double db = 0;if(sdt > edt) { //不合法开始日期一定要小于结束日期db = -1;return db;}//Endif//获得两个时间之间有多少秒edt = (edt - sdt) / 1000;//--------------------------------------------------------------------//if(edt <= 60 * Integer.parseInt(sunini.getIniKey("ClockRoom1"))) { db = 0; //开房后几分钟开始计费,读INI文件设置return db;}//Endif//--------------------------------------------------------------------//if(edt / 60 < 60 * Integer.parseInt(sunini.getIniKey("ClockRoom2"))) { db = 1; //不足几小时按一个单位计费return db;}//Endif//--------------------------------------------------------------------////除以上可能的正常计费公式如下db = edt / 3600; //获得过去的小时数edt = edt % 3600 / 60; //获得多余的分钟数if(edt > Integer.parseInt(sunini.getIniKey("InsuHour2")) && edt <= Integer.parseInt(sunini.getIniKey("InsuHour1"))) {db = db + 0.5; //超过多少分,但小于多少分部分,收半价}else if(edt > Integer.parseInt(sunini.getIniKey("InsuHour2"))) {db = db + 1; //超过多少分的,收全价}//Endif//--------------------------------------------------------------------//return db;}/**=======================================================================* ** [## public static String getConsumeHour(String sDate, String eDate) {} ]:* 参数:String sDate对象表示开始时间* String eDate变量表示结束时间* 返回值:String* 修饰符:public static 可以不实例化对象而直接调用方法* 功能:计算两个时间之间有几小时几分**=======================================================================** */public static String getConsumeHour(String sDate, String eDate) {//获得开始日期时间的--年--月--日--时--分--秒String syh [] = sDate.trim ().split(" ");String symd[] = syh[0].trim().split("-");String shms[] = syh[1].trim().split(":");int sy = Integer.parseInt(symd[0]);int sM = Integer.parseInt(symd[1]);int sd = Integer.parseInt(symd[2]);int sh = Integer.parseInt(shms[0]);int sm = Integer.parseInt(shms[1]);int ss = Integer.parseInt(shms[2]);//获得结束日期时间的--年--月--日--时--分--秒String eyh [] = eDate.trim ().split(" ");String eymd[] = eyh[0].trim().split("-");String ehms[] = eyh[1].trim().split(":");int ey = Integer.parseInt(eymd[0]);int eM = Integer.parseInt(eymd[1]);int ed = Integer.parseInt(eymd[2]);int eh = Integer.parseInt(ehms[0]);int em = Integer.parseInt(ehms[1]);int es = Integer.parseInt(ehms[2]);//获得sDate的long值long sdt = new Timestamp(sy, sM, sd, sh, sm, ss, 0).getTime();//获得eDate的long值long edt = new Timestamp(ey, eM, ed, eh, em, es, 0).getTime();//获得时间差sdt = edt - sdt;//生成过去多少时间的字符串String t = sdt / 3600000 + "小时" + sdt % 3600000 / 60000 + "分";return t;}}ToCap.java/** @(#)ToCap.java 1.24 03/12/19** Copyright 2006 CazoSoft, Inc. All rights reserved.*/package sunsdk.system;/*** <code> ToCap </code>* <p>* 本类用于转化中文大写人民币** @author 鲜强* @version 22.14, 04/05/06* @since CAZOSOFT 1.0*/public class ToCap {/*** 用户设置大写钱数(100,000,000 (一亿)以内).** @param money :* String 接收用户的正实数.* @return : String 包括圆整或角分的中文大写人民币,如果不合法,将返回空(null) */public String setMoney(String money) {String re = null;double num;//测试数据是否合法try {num = Double.parseDouble(money.trim());if (num < 100000000 && num >= 0) {//合法, 使用字符串开始转换re = this.mySetMoney(money);}//end if} catch (Exception ex) {}//end try//返回值return re;}/*** 大写转换函数. 功能: 转换数字为中文大写** @param num :* int 接受整数* @return : String 大写数字零到玖.*/private String setDaXie(int num) {String re = null;switch (num) {case 0:re = "零";break;case 1:re = "壹";break;case 2:re = "贰";break;case 3:re = "叁";break;case 4:re = "肆";break;case 5:re = "伍";break;case 6:re = "陆";break;case 7:re = "柒";break;case 8:re = "捌";break;case 9:re = "玖";break;default:break;}return re;}/*** 处理大写人民币** @param num :* String 接收处理过的字符串(实为数字). * @return : 返回处理过的大写人民币.*/private String mySetMoney(String num) throws Exception {//要返回的字符串String re = "";//转换过程String setNum = null;int index = num.indexOf(".");//处理整数if (index == -1) {setNum = num;} else {setNum = num.substring(0, index);}int weiShu = setNum.length();if (weiShu > 0) {int leng = setNum.length();int numYuan = Integer.parseInt("" + setNum.charAt(weiShu - 1));String zhuanYuan = setDaXie(numYuan);re = zhuanYuan;//个位if (weiShu > 1) {int numShi = Integer.parseInt("" + setNum.charAt(weiShu - 2));String zhuanShi = setDaXie(numShi);//十位re = zhuanShi + "拾" + re;if (weiShu > 2) {int numBai = Integer.parseInt(""+ setNum.charAt(weiShu - 3));String zhuanBai = setDaXie(numBai);//百位re = zhuanBai + "佰" + re;if (weiShu > 3) {int numQian = Integer.parseInt(""+ setNum.charAt(weiShu - 4));String zhuanQian = setDaXie(numQian);//千位re = zhuanQian + "仟" + re;if (weiShu > 4) {int numWan = Integer.parseInt(""+ setNum.charAt(weiShu - 5));String zhuanWan = setDaXie(numWan);//万位re = zhuanWan + "万" + re;if (weiShu > 5) {int numShiWan = Integer.parseInt(""+ setNum.charAt(weiShu - 6));String zhuanShiWan = setDaXie(numShiWan);//十万位re = zhuanShiWan + "拾" + re;if (weiShu > 6) {int numBaiWan = Integer.parseInt(""+ setNum.charAt(weiShu - 7));String zhuanBaiWan = setDaXie(numBaiWan);//百万位re = zhuanBaiWan + "佰" + re;if (weiShu > 7) {int numQianWan = Integer.parseInt(""+ setNum.charAt(weiShu - 8));String zhuanQianWan = setDaXie(numQianWan);//千万位re = zhuanQianWan + "仟" + re;}//end qianwan}//end baiwan}//end shiwan}//end wan}//end qian}//end bai}//end shi}//end yuan//处理小数if (index != -1) {String xiaoShu = num.substring(index + 1, num.length());int leng = xiaoShu.length();int numJiao = Integer.parseInt("" + xiaoShu.charAt(0));String zhuanJiao = setDaXie(numJiao);int numFen;if (leng == 1) {numFen = 0;}//end ifnumFen = Integer.parseInt("" + xiaoShu.charAt(1));String zhuanFen = setDaXie(numFen);//十分位+百分位if (numJiao == 0 && numFen != 0 || numJiao != 0 && numFen != 0) {re = re + "圆" + zhuanJiao + "角" + zhuanFen + "分";} else {re = re + "圆整";}//end if} else {re = re + "圆整";}//end indexreturn re;}}2)swing包CsUIManager.java/** @(#)CsUIManager.java 2006-4-13** public class** Copyright 2006 CazoSoft, Inc. All rights reserved.*/package sunsdk.swing;import java.awt.*;import javax.swing.*;import javax.swing.plaf.metal.*;/*** <code> CsUIManager </code>* <p>* 说明:本类为外观管理器* <p>* <strong>警告:</strong>* 使用金属(BOLD)外观时,输入中文会有异常,但不影响系统运行* <p>* 相关库文件:o.jar** @author 鲜强* @version 2006-4-13 23:05:39* @since CAZOSOFT 1.0*/public class CsUIManager {//Windows 外观public static final int WINDOWS = 0;//Java 默认外观public static final int METAL = 1;//Linux 外观public static final int MOTIF = 2;//WindowsClassic 外观public static final int WINDOWSCLASSIC = 3;//Alloy 外观public static final int ALLOY = 4;//Alloy 玻璃外观public static final int GLASSTHEMEALLOY = 5;//Alloy 迷幻外观public static final int ACIDTHEMEALLOY = 6;//Alloy 贝多因外观public static final int BEDOUIDTHEMEALLOY = 7;//Alloy 默认外观public static final int DEAFULTTHEMEALLOY = 8;//Bold 外观public static final int BOLD = 9;/*** 界面风格选择器** @param cp* 接受要改变的控件* @param style* 接受界面下标* @return 返回成功设置与否*/public static boolean setUI(Component cp, int style) {try {switch (style) {case 0:UIManager.setLookAndFeel("com.sun.java.swing.plaf."+ "windows.WindowsLookAndFeel");break;case 1:UIManager.setLookAndFeel("javax.swing.plaf."+ "metal.MetalLookAndFeel");break;case 2:UIManager.setLookAndFeel("com.sun.java.swing.plaf."+ "motif.MotifLookAndFeel");break;case 3:UIManager.setLookAndFeel("com.sun.java.swing.plaf."+"windows.WindowsClassicLookAndFeel");break;case 4:UIManager.setLookAndFeel("com.incors.plaf."+ "alloy.AlloyLookAndFeel");break;case 5:UIManager.setLookAndFeel("soft.wes.feels."+ "GlassThemeAlloyLookAndFeel");break;case 6:UIManager.setLookAndFeel("soft.wes.feels."+ "AcidThemeAlloyLookAndFeel");break;case 7:UIManager.setLookAndFeel("soft.wes.feels."+ "BedouinThemeAlloyLookAndFeel");break;case 8:UIManager.setLookAndFeel("soft.wes.feels."+ "DefaultThemeAlloyLookAndFeel");break;case 9:UIManager.put("swing.boldMetal", Boolean.FALSE);//可设置对话框外观JDialog.setDefaultLookAndFeelDecorated(true);//可设置设置窗口外观JFrame.setDefaultLookAndFeelDecorated(true);Toolkit.getDefaultToolkit().setDynamicLayout(true);System.setProperty("sun.awt.noerasebackground","true");UIManager.setLookAndFeel(new MetalLookAndFeel());break;}} catch (Exception ex) {JOptionPane.showMessageDialog(null, "更换风格失败,以原风格显。

酒店管理系统实现代码

酒店管理系统实现代码

//入住import java.awt.*;import java。

awt.event。

*;import javax。

swing.*;import javax。

swing.border.Border;import javax。

swing.text.*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame ("入住系统”);JLabel nameLabel = new JLabel(”客户姓名");JLabel idtifyLabel = new JLabel("身份证号”);JLabel roomLabel = new JLabel(”入住房号");JLabel moneyLabel = new JLabel(”应付金额");JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();JButton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1。

go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField。

setDocument(ucDocument);nameField.setForeground(Color.black);//frame。

酒店管理系统实现代码

酒店管理系统实现代码

//入住import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame ("入住系统");JLabel nameLabel = new JLabel("客户");JLabel idtifyLabel = new JLabel("号");JLabel roomLabel = new JLabel("入住房号");JLabel moneyLabel = new JLabel("应付金额");JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();utton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);//frame.addWindowListener(this);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();}});oBox jcb1;//组合框String[] itemList = { "现金", "刷卡" };jcb1 = new oBox(itemList);jcb1.setSelectedIndex(0);button1=new utton("确认支付");button2=new utton("取消支付");final JPanel p1 = new JPanel();p1.add(jcb1);p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "付款方式");p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="确认支付"){ JOptionPane.showMessageDialog(p1,"支付成功","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="取消支付"){ JOptionPane.showMessageDialog(p1,"支付失败","failure",RMATION_MESSAGE);}}});idtifyField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String idtify= idtifyField.getText();String idtifyword= new String(idtify);}});roomField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String room= roomField.getText();String roomword= new String(room);}});moneyField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String money= moneyField.getText();String idtifyword= new String(money);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(4,1));labelPanel.add(nameLabel);labelPanel.add(idtifyLabel);labelPanel.add(roomLabel);labelPanel.add(moneyLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(4,1));fieldPanel.add(nameField);fieldPanel.add(idtifyField);fieldPanel.add(roomField);fieldPanel.add( moneyField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p1,BorderLayout.SOUTH);frame.setSize(200,250);frame.setVisible(true);}public void windowClosing(WindowEvent e1){System.exit(0);}public void windowOpened(WindowEvent e2){}public void windowIconified(WindowEvent e3){}public void windowDeiconified(WindowEvent e4){}public void windowClosed(WindowEvent e5){}public void windowActivated(WindowEvent e6){}public void windowDeactivated(WindowEvent e7){ }}class UpperCaseDocument extends PlainDocument { public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第二个://退房import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A2 extends JFrame {//定义各个组件JFrame frame = new JFrame ("退房系统");JLabel nameLabel = new JLabel("客户");JLabel idtifyLabel = new JLabel("号");JLabel roomLabel = new JLabel("退房号");JLabel timeLabel = new JLabel("退房时间");JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField timeField= new JTextField();utton button1,button2;//JTextArea ta = new JTextArea(5,20);/*public static void main(String args[]){A2 a2 = new A2();a2.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();}});button1=new utton("是");button2=new utton("否");final JPanel p1 = new JPanel();p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(2,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "是否结清消费账单"); p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="是"){ JOptionPane.showMessageDialog(p1,"您的大力支持!","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="否"){ JOptionPane.showMessageDialog(p1,"请结清消费账单","failure",RMATION_MESSAGE);}}});idtifyField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String idtify= idtifyField.getText();String idtifyword= new String(idtify);}});roomField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ String room= roomField.getText();String roomword= new String(room);}});timeField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String time= timeField.getText();String timeword= new String(time);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(4,1)); labelPanel.add(nameLabel);labelPanel.add(idtifyLabel);labelPanel.add(roomLabel);labelPanel.add(timeLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(4,1)); fieldPanel.add(nameField);fieldPanel.add(idtifyField);fieldPanel.add(roomField);fieldPanel.add( timeField);//面板northPanel放面板lanelPanel和面板fieldPanel JPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2)); northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p1,BorderLayout.SOUTH);// frame.pack();frame.setSize(200,230);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第三个://客房预订import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A3 extends JFrame {//定义各个组件JFrame frame = new JFrame ("客房预订");JLabel nameLabel = new JLabel("预订人");JLabel numberLabel = new JLabel("手机号");JTextField nameField = new JTextField();JTextField numberField= new JTextField();JRadioButton rb1 = new JRadioButton("来电预订");JRadioButton rb2 = new JRadioButton("预订");JRadioButton rb3 = new JRadioButton("电传预订");JRadioButton rb4 = new JRadioButton("传真预订");JRadioButton rb5 = new JRadioButton("信函预订");utton button1,button2;/** public static void main(String args[]){A3 a3 = new A3();a3.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();}});oBox jcb1;//组合框String[] itemList = { "总统套房", "双人间","单人间" };jcb1 = new oBox(itemList);jcb1.setSelectedIndex(0);button1=new utton("是");button2=new utton("否");final JPanel p1 = new JPanel();p1.add(jcb1);p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "预订房类型");p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="是"){ JOptionPane.showMessageDialog(p1,"客人预订成功","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="否"){ JOptionPane.showMessageDialog(p1,"客人预订失败","failure",RMATION_MESSAGE);}}});JPanel p2 = new JPanel();p2.add(rb1);p2.add(rb2);p2.add(rb3);p2.add(rb4);p2.add(rb5);p2.setLayout(new FlowLayout());border = BorderFactory.createTitledBorder(etched, "预订方式"); p2.setBorder(border);//创建ButtonGroup按钮组,并在组中添加按钮ButtonGroup group1 = new ButtonGroup();group1.add(rb1);group1.add(rb2);group1.add(rb3);group1.add(rb4);group1.add(rb5);numberField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String number= numberField.getText();String numberword= new String(number);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(2,1));labelPanel.add(nameLabel);labelPanel.add(numberLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(2,1));fieldPanel.add(nameField);fieldPanel.add(numberField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p2,BorderLayout.CENTER);cp.add(p1,BorderLayout.SOUTH);frame.setSize(200,330);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第四个//餐饮预订import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A4 extends JFrame {//定义各个组件JFrame frame = new JFrame ("餐饮预订");JLabel nameLabel = new JLabel("预订人");JLabel timeLabel = new JLabel("预订消费时间");JTextField nameField = new JTextField();JTextField timeField= new JTextField();JCheckBox cb1 = new JCheckBox("中餐");JCheckBox cb2 = new JCheckBox("西餐");JCheckBox cb3 = new JCheckBox("红酒");JCheckBox cb4 = new JCheckBox("饮料");JCheckBox cb5 = new JCheckBox("甜点");JCheckBox cb6 = new JCheckBox("水果");utton button1,button2;/*public static void main(String args[]){A4 a4 = new A4();a4.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();//ta.append("\nUser Name : "+username);}});button1=new utton("是");button2=new utton("否");final JPanel p1 = new JPanel();p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "确认订餐"); p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="是"){ JOptionPane.showMessageDialog(p1,"订餐成功","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="否"){ JOptionPane.showMessageDialog(p1,"订餐失败","failure",RMATION_MESSAGE);}}});timeField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String time= timeField.getText();String timeword= new String(time);}});JPanel p2 = new JPanel();p2.add(cb1);p2.add(cb2);p2.add(cb3);p2.add(cb4);p2.add(cb5);p2.add(cb6);Border etched1 = BorderFactory.createEtchedBorder();Border border1 = BorderFactory.createTitledBorder(etched1, "预订容"); p2.setBorder(border1);//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(4,1));labelPanel.add(nameLabel);labelPanel.add(timeLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(4,1));fieldPanel.add(nameField);fieldPanel.add(timeField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p2,BorderLayout.CENTER);cp.add(p1,BorderLayout.SOUTH);frame.setSize(200,350);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第五个:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A5 extends JFrame {//定义各个组件JFrame frame = new JFrame ("订单管理");JLabel a1 = new JLabel("订单号");JLabel a2 = new JLabel("订货名称");JLabel a3 = new JLabel("收货地址");JLabel a4 = new JLabel("应收金额");JLabel a5 = new JLabel("客户名称");JLabel a6 = new JLabel("结算方式");JLabel a7 = new JLabel("经办人");JTextField b1 = new JTextField();JTextField b2= new JTextField();JTextField b3= new JTextField();JTextField b4= new JTextField();JTextField b5 = new JTextField();JTextField b6 = new JTextField();JTextField b7 = new JTextField();utton button1,button2;public static void main(String args[]){A5 a1 = new A5();a1.go();}public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();b1.setDocument(ucDocument);b1.setForeground(Color.black);b1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = b1.getText();}});oBox jcb1;//组合框String[] itemList = { "现金", "刷卡" };jcb1 = new oBox(itemList);jcb1.setSelectedIndex(0);button1=new utton("确认收款");button2=new utton("取消收款");final JPanel p1 = new JPanel();p1.add(jcb1);p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "收款方式"); p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="确认收款"){ JOptionPane.showMessageDialog(p1,"收款成功","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionmand()=="取消收款"){ JOptionPane.showMessageDialog(p1,"收款失败","failure",RMATION_MESSAGE);}}});b1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String idtify= a1.getText();String idtifyword= new String(idtify);}});b2.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String room= a2.getText();String roomword= new String(room);}});b3.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String money= a3.getText();String idtifyword= new String(money);}});b4.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String money= a4.getText();String idtifyword= new String(money);}});b5.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String money= a5.getText();String idtifyword= new String(money);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(7,1));labelPanel.add(a1);labelPanel.add(a2);labelPanel.add(a3);labelPanel.add(a4);labelPanel.add(a5);labelPanel.add(a6);labelPanel.add(a7);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(7,1));fieldPanel.add(b1);fieldPanel.add(b2);fieldPanel.add(b3);fieldPanel.add( b4);fieldPanel.add( b5);fieldPanel.add( b6);fieldPanel.add( b7);//面板northPanel放面板lanelPanel和面板fieldPanel JPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p1,BorderLayout.SOUTH);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(200,250);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第六个:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.text.*;import javax.swing.border.*;public class F{private JFrame frame;private utton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13;JTextArea ta = new JTextArea(20,20);JTextArea tb = new JTextArea(20,20);public static void main(String args[]){F that=new F();that.go();}void go(){frame=new JFrame("客房检查");Container contentPane=frame.getContentPane();JPanel P1=new JPanel();P1.setLayout(new GridLayout());b1=new utton("101 \n单人间");b2=new utton("102 \n单人间");b3=new utton("103 \n单人间");b4=new utton("104 \n单人间");b5=new utton("105 \n单人间");b6=new utton("201 \n双人间");b7=new utton("202 \n双人间");b8=new utton("203 \n双人间");b9=new utton("204 \n双人间");b10=new utton("205 \n双人间");b11=new utton("301 \n总统套房");b12=new utton("302 \n总统套房");b13=new utton("303 \n总统套房");b1.setBackground(Color.cyan);b2.setBackground(Color.cyan);b3.setBackground(Color.cyan);b4.setBackground(Color.cyan);b5.setBackground(Color.cyan);b6.setBackground(Color.magenta);b7.setBackground(Color.magenta);b8.setBackground(Color.magenta);b9.setBackground(Color.magenta);b10.setBackground(Color.magenta);b11.setBackground(Color.pink);b12.setBackground(Color.pink);b13.setBackground(Color.pink);P1.add(b1);P1.add(b2);P1.add(b3);P1.add(b4);P1.add(b5);P1.add(b6);P1.add(b7);P1.add(b8);P1.add(b9);P1.add(b10);P1.add(b11);P1.add(b12);P1.add(b13);tb.append("房间总数:13");tb.append("\n当前占用:");tb.append("\n当前可供:");P1.add(tb);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionmand()=="101 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n101房间是否打扫:");ta.append("\n101房间里是否有家具损坏:");ta.append("\n101房间是否交足余额:");utton a=new utton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionmand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionmand()=="102 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n102房间是否打扫:");ta.append("\n102房间里是否有家具损坏:");ta.append("\n102房间是否交足余额:");utton a=new utton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionmand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionmand()=="103 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n103房间是否打扫:");ta.append("\n103房间里是否有家具损坏:");ta.append("\n103房间是否交足余额:");utton a=new utton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionmand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionmand()=="104 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n104房间是否打扫:");ta.append("\n104房间里是否有家具损坏:");ta.append("\n104房间是否交足余额:");utton a=new utton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionmand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionmand()=="105 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n105房间是否打扫:");ta.append("\n105房间里是否有家具损坏:");ta.append("\n105房间是否交足余额:");utton a=new utton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionmand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionmand()=="201 \n双人间"){ta.setText("");JFrame frame1=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n201房间是否打扫:");ta.append("\n201房间里是否有家具损坏:");ta.append("\n201房间是否交足余额:");utton a=new utton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionmand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.cyan);frame1.setContentPane(p2);frame1.pack();frame1.setVisible(true);}else if(e.getActionmand()=="202 \n双人间"){ta.setText("");JFrame frame2=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n202房间是否打扫:");ta.append("\n202房间里是否有家具损坏:");ta.append("\n202房间是否交足余额:");utton a=new utton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionmand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.cyan);frame2.setContentPane(p2);frame2.pack();frame2.setVisible(true);}else if(e.getActionmand()=="203 \n双人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n203房间是否打扫:");ta.append("\n203房间里是否有家具损坏:");ta.append("\n203房间是否交足余额:");utton a=new utton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionmand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.cyan);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionmand()=="204 \n双人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n204房间是否打扫:");ta.append("\n204房间里是否有家具损坏:");ta.append("\n204房间是否交足余额:");。

酒店管理系统实现代码

酒店管理系统实现代码

//入住import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame ("入住系统");JLabel nameLabel = new JLabel("客户姓名");JLabel idtifyLabel = new JLabel("身份证号");JLabel roomLabel = new JLabel("入住房号");JLabel moneyLabel = new JLabel("应付金额");JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();JButton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);//frame.addWindowListener(this);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();}});JComboBox jcb1;//组合框String[] itemList = { "现金", "刷卡" };jcb1 = new JComboBox(itemList);jcb1.setSelectedIndex(0);button1=new JButton("确认支付");button2=new JButton("取消支付");final JPanel p1 = new JPanel();p1.add(jcb1);p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "付款方式");p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="确认支付"){ JOptionPane.showMessageDialog(p1,"支付成功","success",RMA TION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="取消支付"){ JOptionPane.showMessageDialog(p1,"支付失败","failure",RMA TION_MESSAGE);}}});idtifyField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String idtify= idtifyField.getText();String idtifyword= new String(idtify);}});roomField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String room= roomField.getText();String roomword= new String(room);}});moneyField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String money= moneyField.getText();String idtifyword= new String(money);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(4,1));labelPanel.add(nameLabel);labelPanel.add(idtifyLabel);labelPanel.add(roomLabel);labelPanel.add(moneyLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(4,1));fieldPanel.add(nameField);fieldPanel.add(idtifyField);fieldPanel.add(roomField);fieldPanel.add( moneyField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p1,BorderLayout.SOUTH);frame.setSize(200,250);frame.setVisible(true);}public void windowClosing(WindowEvent e1){System.exit(0);}public void windowOpened(WindowEvent e2){}public void windowIconified(WindowEvent e3){}public void windowDeiconified(WindowEvent e4){}public void windowClosed(WindowEvent e5){}public void windowActivated(WindowEvent e6){}public void windowDeactivated(WindowEvent e7){ }}class UpperCaseDocument extends PlainDocument { public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第二个://退房import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A2 extends JFrame {//定义各个组件JFrame frame = new JFrame ("退房系统");JLabel nameLabel = new JLabel("客户姓名");JLabel idtifyLabel = new JLabel("身份证号");JLabel roomLabel = new JLabel("退房号");JLabel timeLabel = new JLabel("退房时间");JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField timeField= new JTextField();JButton button1,button2;//JTextArea ta = new JTextArea(5,20);/*public static void main(String args[]){A2 a2 = new A2();a2.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();}});button1=new JButton("是");button2=new JButton("否");final JPanel p1 = new JPanel();p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(2,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "是否结清消费账单");p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="是"){ JOptionPane.showMessageDialog(p1,"谢谢您的大力支持!","success",RMA TION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="否"){ JOptionPane.showMessageDialog(p1,"请结清消费账单","failure",RMA TION_MESSAGE);}}});idtifyField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String idtify= idtifyField.getText();String idtifyword= new String(idtify);}});roomField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ String room= roomField.getText();String roomword= new String(room);}});timeField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e){ String time= timeField.getText();String timeword= new String(time);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(4,1)); labelPanel.add(nameLabel);labelPanel.add(idtifyLabel);labelPanel.add(roomLabel);labelPanel.add(timeLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(4,1)); fieldPanel.add(nameField);fieldPanel.add(idtifyField);fieldPanel.add(roomField);fieldPanel.add( timeField);//面板northPanel放面板lanelPanel和面板fieldPanel JPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2)); northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p1,BorderLayout.SOUTH);// frame.pack();frame.setSize(200,230);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第三个://客房预订import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A3 extends JFrame {//定义各个组件JFrame frame = new JFrame ("客房预订");JLabel nameLabel = new JLabel("预订人姓名");JLabel numberLabel = new JLabel("手机号");JTextField nameField = new JTextField();JTextField numberField= new JTextField();JRadioButton rb1 = new JRadioButton("来电预订");JRadioButton rb2 = new JRadioButton("电话预订");JRadioButton rb3 = new JRadioButton("电传预订");JRadioButton rb4 = new JRadioButton("传真预订");JRadioButton rb5 = new JRadioButton("信函预订");JButton button1,button2;/** public static void main(String args[]){A3 a3 = new A3();a3.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();}});JComboBox jcb1;//组合框String[] itemList = { "总统套房", "双人间","单人间" };jcb1 = new JComboBox(itemList);jcb1.setSelectedIndex(0);button1=new JButton("是");button2=new JButton("否");final JPanel p1 = new JPanel();p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "预订房类型"); p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="是"){ JOptionPane.showMessageDialog(p1,"客人预订成功","success",RMA TION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="否"){ JOptionPane.showMessageDialog(p1,"客人预订失败","failure",RMA TION_MESSAGE);}}});JPanel p2 = new JPanel();p2.add(rb1);p2.add(rb3);p2.add(rb4);p2.add(rb5);p2.setLayout(new FlowLayout());border = BorderFactory.createTitledBorder(etched, "预订方式"); p2.setBorder(border);//创建ButtonGroup按钮组,并在组中添加按钮ButtonGroup group1 = new ButtonGroup();group1.add(rb1);group1.add(rb2);group1.add(rb3);group1.add(rb4);group1.add(rb5);numberField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String number= numberField.getText();String numberword= new String(number);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(2,1));labelPanel.add(nameLabel);labelPanel.add(numberLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(2,1));fieldPanel.add(nameField);fieldPanel.add(numberField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p2,BorderLayout.CENTER);cp.add(p1,BorderLayout.SOUTH);frame.setSize(200,330);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第四个//餐饮预订import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A4 extends JFrame {//定义各个组件JFrame frame = new JFrame ("餐饮预订");JLabel nameLabel = new JLabel("预订人姓名");JLabel timeLabel = new JLabel("预订消费时间");JTextField nameField = new JTextField();JTextField timeField= new JTextField();JCheckBox cb1 = new JCheckBox("中餐");JCheckBox cb2 = new JCheckBox("西餐");JCheckBox cb3 = new JCheckBox("红酒");JCheckBox cb4 = new JCheckBox("饮料");JCheckBox cb5 = new JCheckBox("甜点");JCheckBox cb6 = new JCheckBox("水果");JButton button1,button2;/*public static void main(String args[]){A4 a4 = new A4();a4.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();//ta.append("\nUser Name : "+username);}});button1=new JButton("是");button2=new JButton("否");final JPanel p1 = new JPanel();p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "确认订餐"); p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="是"){ JOptionPane.showMessageDialog(p1,"订餐成功","success",RMA TION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="否"){ JOptionPane.showMessageDialog(p1,"订餐失败","failure",RMA TION_MESSAGE);}}});timeField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String time= timeField.getText();String timeword= new String(time);}});JPanel p2 = new JPanel();p2.add(cb1);p2.add(cb2);p2.add(cb3);p2.add(cb4);p2.add(cb5);p2.add(cb6);Border etched1 = BorderFactory.createEtchedBorder();Border border1 = BorderFactory.createTitledBorder(etched1, "预订内容"); p2.setBorder(border1);//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(4,1));labelPanel.add(nameLabel);labelPanel.add(timeLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(4,1));fieldPanel.add(nameField);fieldPanel.add(timeField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p2,BorderLayout.CENTER);cp.add(p1,BorderLayout.SOUTH);frame.setSize(200,350);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第五个:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A5 extends JFrame {//定义各个组件JFrame frame = new JFrame ("订单管理");JLabel a1 = new JLabel("订单号");JLabel a2 = new JLabel("订货名称");JLabel a3 = new JLabel("收货地址");JLabel a4 = new JLabel("应收金额");JLabel a5 = new JLabel("客户名称");JLabel a6 = new JLabel("结算方式");JLabel a7 = new JLabel("经办人");JTextField b1 = new JTextField();JTextField b2= new JTextField();JTextField b3= new JTextField();JTextField b4= new JTextField();JTextField b5 = new JTextField();JTextField b6 = new JTextField();JTextField b7 = new JTextField();JButton button1,button2;public static void main(String args[]){A5 a1 = new A5();a1.go();}public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();b1.setDocument(ucDocument);b1.setForeground(Color.black);b1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = b1.getText();}});JComboBox jcb1;//组合框String[] itemList = { "现金", "刷卡" };jcb1 = new JComboBox(itemList);jcb1.setSelectedIndex(0);button1=new JButton("确认收款");button2=new JButton("取消收款");final JPanel p1 = new JPanel();p1.add(jcb1);p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "收款方式"); p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="确认收款"){ JOptionPane.showMessageDialog(p1,"收款成功","success",RMA TION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="取消收款"){ JOptionPane.showMessageDialog(p1,"收款失败","failure",RMA TION_MESSAGE);}}});b1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String idtify= a1.getText();String idtifyword= new String(idtify);}});b2.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String room= a2.getText();String roomword= new String(room);}});b3.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String money= a3.getText();String idtifyword= new String(money);}});b4.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String money= a4.getText();String idtifyword= new String(money);}});b5.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e) { String money= a5.getText();String idtifyword= new String(money);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(7,1));labelPanel.add(a1);labelPanel.add(a2);labelPanel.add(a3);labelPanel.add(a4);labelPanel.add(a5);labelPanel.add(a6);labelPanel.add(a7);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(7,1));fieldPanel.add(b1);fieldPanel.add(b2);fieldPanel.add(b3);fieldPanel.add( b4);fieldPanel.add( b5);fieldPanel.add( b6);fieldPanel.add( b7);//面板northPanel放面板lanelPanel和面板fieldPanel JPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p1,BorderLayout.SOUTH);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(200,250);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第六个:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.text.*;import javax.swing.border.*;public class F{private JFrame frame;private JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13;JTextArea ta = new JTextArea(20,20);JTextArea tb = new JTextArea(20,20);public static void main(String args[]){F that=new F();that.go();}void go(){frame=new JFrame("客房检查");Container contentPane=frame.getContentPane();JPanel P1=new JPanel();P1.setLayout(new GridLayout());b1=new JButton("101 \n单人间");b2=new JButton("102 \n单人间");b3=new JButton("103 \n单人间");b4=new JButton("104 \n单人间");b5=new JButton("105 \n单人间");b6=new JButton("201 \n双人间");b7=new JButton("202 \n双人间");b8=new JButton("203 \n双人间");b9=new JButton("204 \n双人间");b10=new JButton("205 \n双人间");b11=new JButton("301 \n总统套房");b12=new JButton("302 \n总统套房");b13=new JButton("303 \n总统套房");b1.setBackground(Color.cyan);b2.setBackground(Color.cyan);b3.setBackground(Color.cyan);b4.setBackground(Color.cyan);b5.setBackground(Color.cyan);b6.setBackground(Color.magenta);b7.setBackground(Color.magenta);b8.setBackground(Color.magenta);b9.setBackground(Color.magenta);b10.setBackground(Color.magenta);b11.setBackground(Color.pink);b12.setBackground(Color.pink);b13.setBackground(Color.pink);P1.add(b1);P1.add(b2);P1.add(b3);P1.add(b4);P1.add(b5);P1.add(b6);P1.add(b7);P1.add(b8);P1.add(b9);P1.add(b10);P1.add(b11);P1.add(b12);P1.add(b13);tb.append("房间总数:13");tb.append("\n当前占用:");tb.append("\n当前可供:");P1.add(tb);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="101 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n101房间是否打扫:");ta.append("\n101房间里是否有家具损坏:");ta.append("\n101房间是否交足余额:");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMA TION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="102 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n102房间是否打扫:");ta.append("\n102房间里是否有家具损坏:");ta.append("\n102房间是否交足余额:");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMA TION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="103 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n103房间是否打扫:");ta.append("\n103房间里是否有家具损坏:");ta.append("\n103房间是否交足余额:");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMA TION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="104 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n104房间是否打扫:");ta.append("\n104房间里是否有家具损坏:");ta.append("\n104房间是否交足余额:");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMA TION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="105 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n105房间是否打扫:");ta.append("\n105房间里是否有家具损坏:");ta.append("\n105房间是否交足余额:");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMA TION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="201 \n双人间"){ta.setText("");JFrame frame1=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n201房间是否打扫:");ta.append("\n201房间里是否有家具损坏:");ta.append("\n201房间是否交足余额:");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMA TION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.cyan);frame1.setContentPane(p2);frame1.pack();frame1.setVisible(true);}else if(e.getActionCommand()=="202 \n双人间"){ta.setText("");JFrame frame2=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n202房间是否打扫:");ta.append("\n202房间里是否有家具损坏:");ta.append("\n202房间是否交足余额:");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMA TION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.cyan);frame2.setContentPane(p2);frame2.pack();frame2.setVisible(true);}else if(e.getActionCommand()=="203 \n双人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n203房间是否打扫:");ta.append("\n203房间里是否有家具损坏:");ta.append("\n203房间是否交足余额:");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){JOptionPane.showMessageDialog(ta,"提交成功",null,RMA TION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.cyan);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="204 \n双人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n204房间是否打扫:");ta.append("\n204房间里是否有家具损坏:");。

酒店管理系统实现代码

酒店管理系统实现代码

//入住import java。

awt.*;import java.awt。

event。

*;import javax。

swing.*;import javax。

swing.border.Border;import javax.swing。

text.*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame ("入住系统”);JLabel nameLabel = new JLabel(”客户姓名");JLabel idtifyLabel = new JLabel(”身份证号");JLabel roomLabel = new JLabel("入住房号");JLabel moneyLabel = new JLabel("应付金额”);JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();JButton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1。

go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField。

setDocument(ucDocument);nameField.setForeground(Color。

black);//frame。

酒店管理系统(c语言)

酒店管理系统(c语言)

附录1。

源程序代码#include〈stdio.h>void search();int main(){int s;printf(” -—-—-—---—---——————--—---——---\n”);printf(” && 长江大酒店欢迎您的光临&&\n”);printf(" -—-——--——--——--————-—-----—-—-\n");printf(" 1。

进入2退出\n”);printf(”请您输入您的选择:”);scanf("%d",&s);//输入选项前的数字if(s==1)//判断s是否为1search();elseprintf("抱歉,您的输入有误!\n");return 0;}void search(){int p[18],q[3],a,b,c,x,y,z;printf(”请选择您需要的服务号码:\n1。

预订房间2。

退订房间\n”);scanf("%d”,&a);//输入服务号码if(a>2||a<1)//判断a是否为1或2{printf("抱歉,您的输入有误,请重新输入!\n”);}else switch(a){case 1://执行预订房间的操作{printf(”请您输入您的身份证号码:\n”);scanf("%d”,&p[18]);//输入身份证18位数字printf("您已成功登入预订系统!!\n");printf("请您选择预订房间标准的号码:\n");printf("1。

单人标准间/夜150元2。

双人标准间/夜200元\n3.豪华套房/夜300元 4.总统套房/夜500元\n”);scanf(”%d",&b);//输入预订房间的种类switch(b){case 1://执行预订单人标准间的操作printf(”请输入预订天数:\n”);scanf(”%d”,&x);//输入预订天数printf("客官需预交款%d元!\n”,x*150);//输出预交款金额printf("1。

简易酒店管理系统代码

简易酒店管理系统代码

简易酒店管理系统代码#include#include#include#include//时间函数的定义structtm*localtime(consttime_t*timep);//时间的初始化char*wday[]={\星期天\星期一\星期二\星期三\星期四\星期五\星期六\time_ttimep;structtm*now;structtm*after;//time(&timep);//酒店房间的定义structhouse{charhouse_number[10];charhouse_shape[2];floathouse_price;intsum_pe rson;//structhouse*next;}h[10]={{\{\{\{\{\{\{\{\{\{\};structguest{//住客姓名、性别、年龄、身份、身份证号码,房号,床号,留宿日期、留宿时间、离店日期、离店时间。

charname[10];charsex[6];intage;charidentify[18];charidentify_number[18];charro om[10];charbed[10];//dateguest_in;//dateguest_out;structtm*p;structtm*q;struct guest*next;};voidfirst_inquiry(){inti=0;intn=0;charch[2]=\for(i=0;i<10;i++){if((strcmp(h[i].house_shape,ch)==0)){if(h[i].sum_person==0){printf(\}}}}voidsecond_inquiry(){{inti=0;intn=0;charch[2]=\for(i=0;i<10;i++){if((strcmp(h[i].house_shape,ch)==0)){if(h[i].sum_person==0){ printf(\}}}}}voidthird_inquiry(){inti=0;intn=0;charch[2]=\for(i=0;i<10;i++){if((strcmp(h[i].house_shape,ch)==0)){if(h[i].sum_person==0){printf(\}}}}voidlookfor_house_is_null(){intyour_choice;do{printf(\你要查询:1.单人间2.双人间3.多人间4.退出:\\n\printf(\输入你的选择:\\t\scanf(\switch(your_choice){case1:printf(\单人间的空余房间:\\t\first_inquiry();printf(\break;case2:printf(\双人房的空余房间:\\t\second_inquiry();printf(\break;case3:printf(\多人间的空余房间:\\t\third_inquiry();printf(\break;case4://exit(1);break;}}while(your_choice !=4);printf(\printf(\}voidadd_house_sum_number(charstr[10]){inti=0;for(i=0;i<10;i++){if((strcmp(h[i] .house_number,str)==0)){h[i].sum_person=1;}else{continue;}}}typedefstructguest*link_guest;//建立link_guestcreate_guest(void){link_guesthead=(link_guest)malloc(sizeof(structgu est));if(head!=null){head->next=null;}else{printf(\}returnhead;}boolis_null_guest(link_guesthead){if(head->next==null){returntrue;}returnfalse;}//写个函数判断一下当输入住客的房号时,是否还有个这个房间boolis_null_this_house(charstr[10]){inti=0;。

酒店管理系统实现代码

酒店管理系统实现代码

//入住import java。

awt。

*;import java.awt。

event.*;import javax。

swing.*;import javax。

swing。

border。

Border;import javax.swing.text.*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame (”入住系统");JLabel nameLabel = new JLabel(”客户姓名”);JLabel idtifyLabel = new JLabel(”身份证号");JLabel roomLabel = new JLabel(”入住房号”);JLabel moneyLabel = new JLabel(”应付金额");JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();JButton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1。

go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);//frame.addWindowListener(this);nameField。

java酒店管理系统毕业设计项目源代码

java酒店管理系统毕业设计项目源代码

一、引言在当今数字化的时代,各行业都在不断实施信息化管理系统,以提高工作效率和服务质量。

酒店行业作为服务业的一部分,也在加快信息化的步伐,以满足客户需求和提升竞争力。

而酒店管理系统作为酒店信息化管理的核心工具,起着至关重要的作用。

本文将介绍一个基于Java语言开发的酒店管理系统毕业设计项目源代码,以及其相关功能和特点。

二、Java酒店管理系统项目源代码介绍1. 项目背景酒店管理系统作为酒店信息化管理的核心工具,可以帮助酒店实现人力资源、客房管理、财务管理等各个方面的信息化管理。

基于这一需求,本项目选择了Java作为开发语言,旨在为酒店提供一个高效、可靠的管理系统。

2. 项目功能该酒店管理系统项目源代码主要包括以下功能:- 客房管理:包括客房信息录入、修改、删除和查询等功能,方便酒店管理人员对客房的管理和调度。

- 订单管理:包括客户下单、订单信息管理等功能,以实现对订单的跟踪和管理。

- 财务管理:包括财务报表生成、财务信息管理等功能,帮助酒店管理人员对财务情况进行分析和监控。

- 员工管理:包括员工信息录入、修改、删除和查询等功能,便于酒店管理人员对员工进行管理和调度。

3. 项目特点这个酒店管理系统项目源代码具有以下特点:- 基于Java语言开发,具有良好的跨评台性和可移植性。

- 使用MVC设计模式,使得系统的各个部分之间更加清晰明了,易于维护和扩展。

- 采用了数据库技术,能够实现数据的持久化存储和高效检索。

- 采用了面向对象的设计思想,使得系统具有良好的可扩展性和可维护性。

三、项目源代码实例介绍以下代码片段展示了该酒店管理系统项目源代码中的一个功能模块-客房管理的部分代码:```javapublic class Room {private String roomId;private String roomType;private int capacity;private boolean available;public Room(String roomId, String roomType, int capacity, boolean available) {this.roomId = roomId;this.roomType = roomType;this.capacity = capacity;this.available = available;}// Getter and Setter methodspublic String getRoomId() {return roomId;}public void setRoomId(String roomId) {this.roomId = roomId;}public String getRoomType() {return roomType;}public void setRoomType(String roomType) {this.roomType = roomType;}public int getCapacity() {return capacity;}public void setCapacity(int capacity) {this.capacity = capacity;}public boolean isAvailable() {return available;}public void setAvailable(boolean available) { this.available = available;}// Other methodspublic void bookRoom() {this.available = false;}public void releaseRoom() {this.available = true;}}```以上代码片段展示了一个客房管理模块的实体类Room,包括了客房的基本信息和相关操作。

酒店管理系统代码

酒店管理系统代码

#include <windows.h>#include <dos.h>#include<stdio.h>#include<stdlib.h>#include<time.h>//-------------------------------------------------- 结构定义 ------------------------------------------typedefstructCheckinInformation{char name[10]; // 姓名int id; // 证件号introomType; // 房型intcountType; // 计费方式}CheckinInfo;typedefstructHotelRoom{introomType; // 房型introomNum; // 房号int checked; // 入住情况int price; // 房价}Room;typedefstructRoomOrder{CheckinInfo *checkinInfo; // 入住信息long date; // 入住时间Room * room; // 房间信息}Order;typedefstructHotelInfomation{intcheckinAmount; // 已入住房数intsingleRemainAmount; // 单人房剩余房数intdoubleRemainAmount; // 双人房剩余房数intbigRemainAmount; // 大床房剩余房数}HotelInfo;//-------------------------------- 枚举类型 ---------------------------enum {MainUI,HotelInfoUI,CheckinUI,CheckinResultUI,OrderUI,CheckOutUI,Exit};//GUIenum {Single,Double,Big};//Room Typeenum {Hour,Day};//countType//-------------------------------- 全局变量 --------------------------int GUI = MainUI;Order*orderList[100]; Room*roomList[100]; // 订单数组// 房间数组HotelInfo * hotelInfo = NULL;// 酒店房间信息//------------------------------- 函数声明 ---------------------------- voidinitiallizeRoomList();voidinsertToOrderList(Order * order);Room* getRoomByType(introomType);Order* getOrderByRoomNum(introomNum);voidshowMainUI();voidshowHotelInfoUI();voidshowCheckinUI();voidshowCheckinResultUI();voidshowOrderUI();voidshowCheckOutUI();//-------------------------------Main函数 ----------------------------void main() // 主函数{//初始化酒店房间信息hotelInfo = (HotelInfo *)malloc(sizeof(HotelInfo));hotelInfo ->singleRemainAmount = 20;hotelInfo ->doubleRemainAmount=40;hotelInfo ->bigRemainAmount=40;hotelInfo ->checkinAmount=0;//初始化房间列表initiallizeRoomList();//界面显示while(GUI != Exit){switch(GUI){caseMainUI:showMainUI();break; caseHotelInfoUI:showHotelInfoUI();break;caseCheckinUI:showCheckinUI();break;caseCheckinResultUI:showCheckinResultUI();break;caseOrderUI:showOrderUI();break;caseCheckOutUI:showCheckOutUI();break;default:break;}}}//------------------------------- 函数定义----------------------------voidinitiallizeRoomList(){//房间数组初始化,初始化的结果是让 roomList 的数组有 100 个 room 指针,而且设置了相应的值inti;Room*newRoom=NULL;for(i=0;i<20;i++){// 单人房房间信息初始化newRoom = ( Room* )malloc(sizeof(Room));roomList[i] = newRoom;roomList[i]->checked=0;roomList[i]->price=110;roomList[i]->roomNum=i+1;roomList[i]->roomType=Single;}for(i=20;i<60;i++){// 双人房房间信息初始化newRoom = ( Room* )malloc(sizeof(Room));roomList[i] = newRoom; roomList[i]->checked=0; roomList[i]->price=180; roomList[i]->roomNum=i+1;roomList[i]->roomType=Double;}// 大床房房间信息初始化for(i=60;i<100;i++){newRoom = ( Room* )malloc(sizeof(Room));roomList[i] = newRoom;roomList[i]->checked=0;roomList[i]->price=180;roomList[i]->roomNum=i+1;roomList[i]->roomType=Big;}}// 通过所选择的房型获取空房间,获取房间后将房间信息改为已入住,并减少相应房型的剩余房间数Room* getRoomByType(introomType){inti;switch(roomType){case Single:for(i=0;i<20;i++){if(roomList[i]->checked == 0){roomList[i]->checked=1;hotelInfo->singleRemainAmount -- ;hotelInfo->checkinAmount++;returnroomList[i];}}break;case Double:for(i=20;i<60;i++){if(roomList[i]->checked == 0){roomList[i]->checked=1;hotelInfo->doubleRemainAmount -- ;hotelInfo->checkinAmount++;returnroomList[i];}}break;case Big:for(i=60;i<100;i++){if(roomList[i]->checked == 0){roomList[i]->checked=1;hotelInfo->bigRemainAmount --;hotelInfo->checkinAmount++;returnroomList[i];}}break;}}//将订单放入订单列表voidinsertToOrderList(Order * order){inti;for(i = 0;i<100;i++){if(orderList[i] ==NULL ){orderList[i] = order;break;}}}//通过房号查询订单Order* getOrderByRoomNum(introomNum){inti;for(i=0;i<100;i++){if(orderList[i]->room->roomNum == roomNum){returnorderList[i]; }}}voidshowMainUI(){//显示主界面,并接受输入intchooseNum;system("cls");printf("\n\n========================== 酒店房间登记与计费管理管理系统=======================\t\n\n\n");printf("*\t\t\ t\t1.入住登记\t\t\t\t*\n");printf("*\t\t\t\t2. 查询入住情况\t\t\t*\n");printf("*\t\t\t\t3. 查询当前费用\t\t\t*\n");printf("*\t\t\t\t4. 结账退房\t\t\t\t*\n");printf("*\t\t\t\t5. 退出程序\t\t\t\t*\n\n\n");printf("\n\n========================== 酒店房间登记与计费管理管理系统 =======================\t\n\n\n");printf(" 请输入相应编号进入菜单 \t");//接受输入scanf("%d",&chooseNum);switch(chooseNum){case 1:GUI = HotelInfoUI;break;case 2:GUI = HotelInfoUI;break;case 3:GUI = OrderUI;break;case 4:GUI = OrderUI;break;case 5:专业资料整理Sleep(3000);GUI = Exit;break;default:break;专业资料整理}}voidshowHotelInfoUI(){intchooseNum;system("cls");printf("\n\n========================= 酒店入住情况查询菜单=======================\t\n\n\n\n");printf("*\t\t\t 入住房间数 : %d\t\t\t\t*\n", hotelInfo->checkinAmount);printf("*\t\t\t 剩余房间数 : \t");printf(" 单人房: %d\t\t*\n",hotelInfo->singleRemainAmount);printf("*\t\t\t\t\t 双人房: %d\t\t*\n",hotelInfo->doubleRemainAmount);printf("*\t\t\t\t\t 大床房: %d\t\t*\n\n",hotelInfo->bigRemainAmount);printf("\n\n========================= 酒店入住情况查询菜单=======================\t\n\n\n");printf(" 按 0 :返回\n");printf(" 按 1 : 登记入住 \n");scanf("%d",&chooseNum);switch(chooseNum){case 0:GUI = MainUI;break;case 1:GUI = CheckinUI;break;default:GUI = HotelInfoUI;break;}}voidshowCheckinUI(){Order * newOrder;Room* newRoom = NULL;//填写一个新的入住信息CheckinInfo * newCheckinInfo = NULL;专业资料整理introomTypeNum;intcountTypeNum;专业资料整理time_ttimep;system("cls");printf("\n\n=========================== 酒店入住登记菜单=========================\t\n\n\n");newCheckinInfo = ( CheckinInfo * )malloc(sizeof(CheckinInfo));printf("*\t\t 请输入姓名 :");scanf("%s", &(newCheckinInfo->name) );printf("*\t\t 请输入证件号 :");scanf("%d", &(newCheckinInfo->id) );printf("*\t\t 请选择入住房型 :\n");printf("\t\t\t1. 单人房 \n\t\t\t2. 双人房\n\t\t\t3. 大床房 \n"); scanf("%d",&(roomTypeNum));switch(roomTypeNum) // 通过输入的数字对应房型{case 1:newCheckinInfo->roomType = Single;break;case 2:newCheckinInfo->roomType = Double;break;case 3:newCheckinInfo->roomType = Big;break;default:newCheckinInfo->roomType = Single;break;}printf("*\ t\tprintf("\t \t\t1. 请选择计费方式:\n");按小时计费 ;\n\t\t\t2.按天数计费\n"); // 通过输入的数字对应计费方式scanf("%d",&countTypeNum);switch(countTypeNum){case 1:专业资料整理newCheckinInfo->countType = Hour;break;case 2:专业资料整理newCheckinInfo->countType = Day;break;}printf("\n\n=========================== 酒店入住登记菜单=========================\t\n\n\n");//生成一个新的订单newOrder = ( Order* )malloc(sizeof(Order));newOrder ->checkinInfo = newCheckinInfo;newOrder -> date = time(0);switch(newCheckinInfo->roomType){case Single:newRoom = getRoomByType(Single);break;case Double:newRoom=getRoomByType(Double);break;case Big :newRoom=getRoomByType(Big);break; // 通过房型获取房间}newOrder->room = newRoom; insertToOrderList(newOrder);print f(" 房间号为:%d\n",newOrder->room->roomNum);GUI = CheckinResultUI;}voidshowCheckinResultUI(){intchooseNum;printf("\n\n========================= 酒店入住登记确认菜单=======================\t\n\n\n");printf("\t\t\t************\t\t\t\t\n");printf("\t\t\t* 登记成功*\t\t\t\t\n");printf("\t\t\t************\t\t\t\t\n\n");printf("\n\n========================= 酒店入住登记确认菜单=======================\t\n\n\n");专业资料整理printf(" 按 0 :返回\n");scanf("%d",&chooseNum);专业资料整理switch(chooseNum){case 0:GUI = MainUI;break;default:GUI = CheckinResultUI;break;}}voidshowOrderUI(){introomNum;intchooseNum;int amount;Order * theOrder = NULL;system("cls");printf("\n\n========================= 酒店房间信息查询菜单=======================\t\n\n\n");printf(" 请输入房间号 :");scanf("%d",&roomNum);if (roomNum<0 || roomNum>100){printf("\n 输入有误请重新输入") ;GUI = OrderUI;}else{theOrder = getOrderByRoomNum(roomNum);printf(" 房型: ");switch(theOrder->room->roomType){case Single:printf(" 单人房 \n");break;case Double:printf(" 双人房 \n");break;case Big:printf(" 大床房 \n");break;}printf(" 计费方式: ");专业资料整理switch(theOrder->checkinInfo->countType ) {专业资料整理case Hour:printf(" 小时计费 \n");amount = (time(0) - theOrder->date) / 3600 +1;printf(" 已入住时间: %d 小时 \n",amount);break;case Day:printf(" 天计费 \n");amount = (time(0) - theOrder->date) / (3600*24) +1;printf(" 已入住时间: %d 天\n",amount);break;}printf(" 房价: %d\n",theOrder->room->price);printf(" 应支付: %d\n\n",amount * theOrder->room->price);printf("\n\n========================= 酒店房间信息查询菜单=======================\t\n\n\n");printf(" 按 0:返回 \n");printf(" 按 1:结账退房 \n");scanf("%d",&chooseNum);switch(chooseNum){case 0:GUI = MainUI;break;case 1:GUI = CheckOutUI;break;default:break;}}}voidshowCheckOutUI(){intchooseNum;printf("\n\n========================= 酒店结账退房确认菜单=======================\t\n\n\n");printf("\t\t\t\t************\t\t\t\t\n");printf("\t\t\t\t* 结账成功*\t\t\t\t\n");printf("\t\t\t\t************\t\t\t\t\n\n");printf("\n\n========================= 酒店结账退房确认菜单=======================\t\n\n\n");printf(" 按 0 :返回 "); scanf("%d",&chooseNum);switch(chooseNum) {case 0:GUI = MainUI;break;default:GUI = CheckOutUI;break;}}。

酒店管理系统实现代码

酒店管理系统实现代码

酒店管理系统实现代码(总77页)本页仅作为文档封面,使用时可以删除This document is for reference only-rar21year.March//入住import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame ("入住系统");JLabel nameLabel = new JLabel("客户姓名");JLabel idtifyLabel = new JLabel("身份证号");JLabel roomLabel = new JLabel("入住房号");JLabel moneyLabel = new JLabel("应付金额");JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();JButton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);//frame.addWindowListener(this);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();}});JComboBox jcb1;//组合框String[] itemList = { "现金", "刷卡" };jcb1 = new JComboBox(itemList);jcb1.setSelectedIndex(0);button1=new JButton("确认支付");button2=new JButton("取消支付");final JPanel p1 = new JPanel();p1.add(jcb1);p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "付款方式");p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="确认支付"){JOptionPane.showMessageDialog(p1,"支付成功","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public voidactionPerformed(ActionEvent e){if (e.getActionCommand()=="取消支付"){JOptionPane.showMessageDialog(p1,"支付失败","failure", RMATION_MESSAGE);}}});idtifyField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String idtify= idtifyField.getText();String idtifyword= new String(idtify);}});roomField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String room= roomField.getText();String roomword= new String(room);}});moneyField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String money= moneyField.getText();String idtifyword= new String(money);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(4,1));labelPanel.add(nameLabel);labelPanel.add(idtifyLabel);labelPanel.add(roomLabel);labelPanel.add(moneyLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(4,1));fieldPanel.add(nameField);fieldPanel.add(idtifyField);fieldPanel.add(roomField);fieldPanel.add( moneyField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在north cp.add(p1,BorderLayout.SOUTH);frame.setSize(200,250);frame.setVisible(true);}public void windowClosing(WindowEvent e1){System.exit(0);}public void windowOpened(WindowEvent e2){}public void windowIconified(WindowEvent e3){}public void windowDeiconified(WindowEvent e4){}public void windowClosed(WindowEvent e5){}public void windowActivated(WindowEvent e6){}public void windowDeactivated(WindowEvent e7){}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第二个://退房import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A2 extends JFrame {//定义各个组件JFrame frame = new JFrame ("退房系统");JLabel nameLabel = new JLabel("客户姓名");JLabel idtifyLabel = new JLabel("身份证号");JLabel roomLabel = new JLabel("退房号");JLabel timeLabel = new JLabel("退房时间");JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField timeField= new JTextField();JButton button1,button2;//JTextArea ta = new JTextArea(5,20);/*public static void main(String args[]){A2 a2 = new A2();a2.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();}});button1=new JButton("是");button2=new JButton("否");final JPanel p1 = new JPanel();p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(2,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "是否结清消费账单");p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="是"){JOptionPane.showMessageDialog(p1,"谢谢您的大力支持!","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public voidactionPerformed(ActionEvent e){if (e.getActionCommand()=="否"){JOptionPane.showMessageDialog(p1,"请结清消费账单","failure",RMATION_MESSAGE);}}});idtifyField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String idtify= idtifyField.getText();String idtifyword= new String(idtify);}});roomField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String room= roomField.getText();String roomword= new String(room);}});timeField.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { String time= timeField.getText();String timeword= new String(time);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(4,1));labelPanel.add(nameLabel);labelPanel.add(idtifyLabel);labelPanel.add(roomLabel);labelPanel.add(timeLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(4,1));fieldPanel.add(nameField);fieldPanel.add(idtifyField);fieldPanel.add(roomField);fieldPanel.add( timeField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p1,BorderLayout.SOUTH);// frame.pack();frame.setSize(200,230);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第三个://客房预订import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A3 extends JFrame {//定义各个组件JFrame frame = new JFrame ("客房预订");JLabel nameLabel = new JLabel("预订人姓名");JLabel numberLabel = new JLabel("手机号");JTextField nameField = new JTextField();JTextField numberField= new JTextField();JRadioButton rb1 = new JRadioButton("来电预订");JRadioButton rb2 = new JRadioButton("电话预订");JRadioButton rb3 = new JRadioButton("电传预订");JRadioButton rb4 = new JRadioButton("传真预订");JRadioButton rb5 = new JRadioButton("信函预订");JButton button1,button2;/** public static void main(String args[]){A3 a3 = new A3();a3.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();}});JComboBox jcb1;//组合框String[] itemList = { "总统套房", "双人间","单人间" };jcb1 = new JComboBox(itemList);jcb1.setSelectedIndex(0);button1=new JButton("是");button2=new JButton("否");final JPanel p1 = new JPanel();p1.add(jcb1);p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "预订房类型");p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="是"){JOptionPane.showMessageDialog(p1,"客人预订成功","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public voidactionPerformed(ActionEvent e){if (e.getActionCommand()=="否"){JOptionPane.showMessageDialog(p1,"客人预订失败","failure", RMATION_MESSAGE);}}});JPanel p2 = new JPanel();p2.add(rb1);p2.add(rb2);p2.add(rb3);p2.add(rb4);p2.add(rb5);p2.setLayout(new FlowLayout());border = BorderFactory.createTitledBorder(etched, "预订方式");p2.setBorder(border);//创建ButtonGroup按钮组,并在组中添加按钮ButtonGroup group1 = new ButtonGroup();group1.add(rb1);group1.add(rb2);group1.add(rb3);group1.add(rb4);group1.add(rb5);numberField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String number= numberField.getText();String numberword= new String(number);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(2,1));labelPanel.add(nameLabel);labelPanel.add(numberLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(2,1));fieldPanel.add(nameField);fieldPanel.add(numberField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p2,BorderLayout.CENTER);cp.add(p1,BorderLayout.SOUTH);frame.setSize(200,330);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第四个//餐饮预订import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A4 extends JFrame {//定义各个组件JFrame frame = new JFrame ("餐饮预订");JLabel nameLabel = new JLabel("预订人姓名");JLabel timeLabel = new JLabel("预订消费时间");JTextField nameField = new JTextField();JTextField timeField= new JTextField();JCheckBox cb1 = new JCheckBox("中餐");JCheckBox cb2 = new JCheckBox("西餐");JCheckBox cb3 = new JCheckBox("红酒");JCheckBox cb4 = new JCheckBox("饮料");JCheckBox cb5 = new JCheckBox("甜点");JCheckBox cb6 = new JCheckBox("水果");JButton button1,button2;/*public static void main(String args[]){A4 a4 = new A4();a4.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField.setForeground(Color.black);nameField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = nameField.getText();//ta.append("\nUser Name : "+username);}});button1=new JButton("是");button2=new JButton("否");final JPanel p1 = new JPanel();p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "确认订餐");p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="是"){JOptionPane.showMessageDialog(p1,"订餐成功","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public voidactionPerformed(ActionEvent e){if (e.getActionCommand()=="否"){JOptionPane.showMessageDialog(p1,"订餐失败","failure", RMATION_MESSAGE);}}});timeField.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String time= timeField.getText();String timeword= new String(time);}});JPanel p2 = new JPanel();p2.add(cb1);p2.add(cb2);p2.add(cb3);p2.add(cb4);p2.add(cb5);p2.add(cb6);Border etched1 = BorderFactory.createEtchedBorder();Border border1 = BorderFactory.createTitledBorder(etched1, "预订内容");p2.setBorder(border1);//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(4,1));labelPanel.add(nameLabel);labelPanel.add(timeLabel);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(4,1));fieldPanel.add(nameField);fieldPanel.add(timeField);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p2,BorderLayout.CENTER);cp.add(p1,BorderLayout.SOUTH);frame.setSize(200,350);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet); }}第五个:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.border.Border;import javax.swing.text.*;public class A5 extends JFrame {//定义各个组件JFrame frame = new JFrame ("订单管理");JLabel a1 = new JLabel("订单号");JLabel a2 = new JLabel("订货名称");JLabel a3 = new JLabel("收货地址");JLabel a4 = new JLabel("应收金额");JLabel a5 = new JLabel("客户名称");JLabel a6 = new JLabel("结算方式");JLabel a7 = new JLabel("经办人");JTextField b1 = new JTextField();JTextField b2= new JTextField();JTextField b3= new JTextField();JTextField b4= new JTextField();JTextField b5 = new JTextField();JTextField b6 = new JTextField();JTextField b7 = new JTextField();JButton button1,button2;public static void main(String args[]){A5 a1 = new A5();a1.go();}public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();b1.setDocument(ucDocument);b1.setForeground(Color.black);b1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String username = b1.getText();}});JComboBox jcb1;//组合框String[] itemList = { "现金", "刷卡" };jcb1 = new JComboBox(itemList);jcb1.setSelectedIndex(0);button1=new JButton("确认收款");button2=new JButton("取消收款");final JPanel p1 = new JPanel();p1.add(jcb1);p1.add(button1);p1.add(button2);p1.setLayout(new GridLayout(3,1));Border etched = BorderFactory.createEtchedBorder();Border border = BorderFactory.createTitledBorder(etched, "收款方式");p1.setBorder(border);button1.addActionListener(new ActionListener(){public void actionPerformed(ActionEvent e){if (e.getActionCommand()=="确认收款"){JOptionPane.showMessageDialog(p1,"收款成功","success",RMATION_MESSAGE);}}});button2.addActionListener(new ActionListener(){public voidactionPerformed(ActionEvent e){if (e.getActionCommand()=="取消收款"){JOptionPane.showMessageDialog(p1,"收款失败","failure", RMATION_MESSAGE);}}});b1.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String idtify= a1.getText();String idtifyword= new String(idtify);}});b2.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String room= a2.getText();String roomword= new String(room);}});b3.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String money= a3.getText();String idtifyword= new String(money);}});b4.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String money= a4.getText();String idtifyword= new String(money);}});b5.addActionListener(new ActionListener(){ public void actionPerformed(ActionEvent e){ String money= a5.getText();String idtifyword= new String(money);}});//面板labelPanel放标签JPanel labelPanel = new JPanel();labelPanel.setLayout(new GridLayout(7,1));labelPanel.add(a1);labelPanel.add(a2);labelPanel.add(a3);labelPanel.add(a4);labelPanel.add(a5);labelPanel.add(a6);labelPanel.add(a7);//面板fieldPanel放文本框JPanel fieldPanel = new JPanel();fieldPanel.setLayout(new GridLayout(7,1));fieldPanel.add(b1);fieldPanel.add(b2);fieldPanel.add(b3);fieldPanel.add( b4);fieldPanel.add( b5);fieldPanel.add( b6);fieldPanel.add( b7);//面板northPanel放面板lanelPanel和面板fieldPanelJPanel northPanel = new JPanel();northPanel.setLayout(new GridLayout(1,2));northPanel.add(labelPanel);northPanel.add(fieldPanel);Container cp = frame.getContentPane();cp.add(northPanel,BorderLayout.NORTH);//northPanel放在northcp.add(p1,BorderLayout.SOUTH);frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);frame.setSize(200,250);frame.setVisible(true);}}class UpperCaseDocument extends PlainDocument{ public void insertString(int offset,String string, AttributeSet attributeSet)throws BadLocationException{ string = string.toUpperCase();super.insertString(offset,string, attributeSet);}}第六个:import java.awt.*;import java.awt.event.*;import javax.swing.*;import javax.swing.text.*;import javax.swing.border.*;public class F{private JFrame frame;private JButton b1,b2,b3,b4,b5,b6,b7,b8,b9,b10,b11,b12,b13; JTextArea ta = new JTextArea(20,20);JTextArea tb = new JTextArea(20,20);public static void main(String args[]){F that=new F();that.go();}void go(){frame=new JFrame("客房检查");Container contentPane=frame.getContentPane();JPanel P1=new JPanel();P1.setLayout(new GridLayout());b1=new JButton("101 \n单人间");b2=new JButton("102 \n单人间");b3=new JButton("103 \n单人间");b4=new JButton("104 \n单人间 ");b5=new JButton("105 \n单人间");b6=new JButton("201 \n双人间");b7=new JButton("202 \n双人间");b8=new JButton("203 \n双人间");b9=new JButton("204 \n双人间");b10=new JButton("205 \n双人间");b11=new JButton("301 \n总统套房");b12=new JButton("302 \n总统套房");b13=new JButton("303 \n总统套房");b1.setBackground(Color.cyan);b2.setBackground(Color.cyan);b3.setBackground(Color.cyan);b4.setBackground(Color.cyan);b5.setBackground(Color.cyan);b6.setBackground(Color.magenta);b7.setBackground(Color.magenta);b8.setBackground(Color.magenta);b9.setBackground(Color.magenta);b10.setBackground(Color.magenta);b11.setBackground(Color.pink);b12.setBackground(Color.pink);b13.setBackground(Color.pink);P1.add(b1);P1.add(b2);P1.add(b3);P1.add(b4);P1.add(b5);P1.add(b6);P1.add(b7);P1.add(b8);P1.add(b9);P1.add(b10);P1.add(b11);P1.add(b12);P1.add(b13);tb.append("房间总数:13");tb.append("\n当前占用:");tb.append("\n当前可供:");P1.add(tb);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="101 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n101房间是否打扫: ");ta.append("\n101房间里是否有家具损坏: ");ta.append("\n101房间是否交足余额: ");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功 ",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="102 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n102房间是否打扫: ");ta.append("\n102房间里是否有家具损坏: ");ta.append("\n102房间是否交足余额: ");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功 ",null, RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="103 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n103房间是否打扫: ");ta.append("\n103房间里是否有家具损坏: ");ta.append("\n103房间是否交足余额: ");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功 ",null, RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="104 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n104房间是否打扫: ");ta.append("\n104房间里是否有家具损坏: ");ta.append("\n104房间是否交足余额: ");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功 ",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="105 \n单人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n105房间是否打扫: ");ta.append("\n105房间里是否有家具损坏: ");ta.append("\n105房间是否交足余额: ");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功 ",null, RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.yellow);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="201 \n双人间"){ta.setText("");JFrame frame1=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n201房间是否打扫: ");ta.append("\n201房间里是否有家具损坏: ");ta.append("\n201房间是否交足余额: ");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功 ",null, RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.cyan);frame1.setContentPane(p2);frame1.pack();frame1.setVisible(true);}else if(e.getActionCommand()=="202 \n双人间"){ta.setText("");JFrame frame2=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n202房间是否打扫: ");ta.append("\n202房间里是否有家具损坏: ");ta.append("\n202房间是否交足余额: ");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功 ",null,RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.cyan);frame2.setContentPane(p2);frame2.pack();frame2.setVisible(true);}else if(e.getActionCommand()=="203 \n双人间"){ta.setText("");JFrame frame=new JFrame("检查信息");JPanel p2=new JPanel();Container cp=frame.getContentPane();ta.append("\n203房间是否打扫: ");ta.append("\n203房间里是否有家具损坏: ");ta.append("\n203房间是否交足余额: ");JButton a=new JButton("提交");p2.add(a);ActionListener al=new ActionListener(){public void actionPerformed(ActionEvent e){if(e.getActionCommand()=="提交"){ JOptionPane.showMessageDialog(ta,"提交成功 ",null, RMATION_MESSAGE);}}};a.addActionListener(al);p2.add(ta);p2.setBackground(Color.cyan);frame.setContentPane(p2);frame.pack();frame.setVisible(true);}else if(e.getActionCommand()=="204 \n双人间"){ta.setText("");。

酒店管理系统实现代码

酒店管理系统实现代码

//入住import java.awt。

*;import java。

awt。

event.*;import javax。

swing。

*;import javax。

swing。

border。

Border;import javax.swing.text。

*;public class A1 extends JFrame implements WindowListener {//定义各个组件JFrame frame = new JFrame ("入住系统");JLabel nameLabel = new JLabel(”客户姓名”);JLabel idtifyLabel = new JLabel("身份证号”);JLabel roomLabel = new JLabel("入住房号");JLabel moneyLabel = new JLabel("应付金额”);JTextField nameField = new JTextField();JTextField idtifyField= new JTextField();JTextField roomField= new JTextField();JTextField moneyField= new JTextField();JButton button1,button2;/*public static void main(String args[]){A1 a1 = new A1();a1.go();}*/public void go(){UpperCaseDocument ucDocument = new UpperCaseDocument();nameField.setDocument(ucDocument);nameField。

setForeground(Color。

black);//frame。

  1. 1、下载文档前请自行甄别文档内容的完整性,平台不提供额外的编辑、内容补充、找答案等附加服务。
  2. 2、"仅部分预览"的文档,不可在线预览部分如存在完整性等问题,可反馈申请退款(可完整预览的文档不适用该条件!)。
  3. 3、如文档侵犯您的权益,请联系客服反馈,我们会尽快为您处理(人工客服工作时间:9:00-18:30)。

酒店管理系统源代码#include<string.h>#include<stdlib.h>#include<stdio.h>#include<conio.h>typedef struct tagCustomer{char m_ID[19]; /*身份证号码*/ char m_name[10]; /*顾客姓名*/ int m_age; /*顾客年龄*/ char m_sex[6]; /*顾客性别*/ int num;}Customer;/*顾客结构*/typedef struct tagRoom{int m_num; /*房间号*/ int m_floor; /*楼层*/int m_price; /*价格*/int m_use; /*是否已入住*/}Room;/*房间结构*/int i,j=0,age,num,floor,price,use,n;int reg =0;Customer cus[5];Room r[5];int count=5;char ID[18],name[10],sex[6];FILE *fproom;FILE *fpcustomer;void Customer_Input(){if(count<=5){printf("请输入身份证号(18位数字):");scanf("%s",&cus[j].m_ID);printf("请输入姓名(10位字符)");scanf("%s",&cus[j].m_name);printf("请输入年龄(数字型)");scanf("%d",&cus[j].m_age);printf("请输入性别(男或女):");scanf("%s",&cus[j].m_sex);}else{printf("\n 存储空间已满!");}printf("\n\r顾客可以住在:");printf("\n\r房间号楼层价格是否空闲(1:空闲0:已使用)");for(i=0;i<count;i++){if(r[i].m_use==1){printf("\n\r%d %d %d %d ",r[i].m_num,r[i].m_floor,r[i].m_price,r[i].m_use);}}printf("\n\r请你输入房间号:");scanf("%d",&num);reg = 0;for(i=0;i<count;i++){if(r[i].m_use==1&&r[i].m_num==num){r[i].m_use = 0;printf("\n 登记成功!\n");cus[j].num=r[i].m_num ;j=j+1;reg=1;}}if(reg==0){printf("\n 登记失败!\n");}}void Customer_ListOut(){if(count<=5){printf("请输入身份证号(18位数字):");scanf("%s",&ID);for(i=0;i<count;i++)if(strcmp(cus[i].m_ID,ID)==0){printf("\n\r顾客身份证号:%s 姓名:%s 年龄:%d 性别:%s \n",cus[i].m_ID,cus[i].m_name,cus[i].m_age,cus[i].m_sex);}}}else{printf("\n \n");}}void Room_ListOut(){printf("\n\r房间号楼层价格是否空闲(1:空闲0:已使用)");for(i=0;i<count;i++){if(r[i].m_use==1){printf("\n\r%d %d %d %d ",r[i].m_num,r[i].m_floor,r[i].m_price,r[i].m_use);}}}void PerCustomer_Search(){if(count<=5){printf("请输入身份证号(18位数字):");scanf("%s",&cus[j].m_ID);printf("请输入姓名(10位字符)");scanf("%s",&cus[j].m_name);printf("请输入年龄(数字型)");scanf("%d",&cus[j].m_age);printf("请输入性别(男或女):");scanf("%s",&cus[j].m_sex);}else{printf("\n 住房已满!");}printf("\n\r顾客可以预订:");printf("\n\r房间号楼层价格是否空闲(1:空闲0:已使用)");for(i=0;i<count;i++){if(r[i].m_use==1){printf("\n\r%d %d %d %d ",r[i].m_num,r[i].m_floor,r[i].m_price,r[i].m_use);}}printf("\n 请你输入要预订的房间号:");scanf("%d",&num);reg = 0;for(i=0;i<count;i++){if(r[i].m_use==1&&r[i].m_num==num){r[i].m_use = 0;printf("\n 预订成功!\n");cus[j].num=r[i].m_num ;j=j+1;reg=1;}}if(reg==0){printf("\n 预订失败!\n");}}void UnCustomer_Out(){int k;printf("\n 请输入要退房顾客身份证:");scanf("%s",&ID);for(i=0;i<count;i++){if(strcmp(cus[i].m_ID,ID)==0){printf("\n\r顾客身份证号:%s 姓名:%s 年龄:%d 性别:%s \n\r已经成功退房!",cus[i].m_ID,cus[i].m_name,cus[i].m_age,cus[i].m_sex);for(k=0;k<count;k++)if(r[k].m_num==cus[i].num)r[k].m_use=1;memset(&cus[i],0,sizeof(Customer));}}}void Customer_Goaway(){fproom=fopen("room","wb+");fwrite((void *)&r,sizeof(Room),count,fproom); fclose(fproom);fpcustomer=fopen("customer","wb+");fwrite((void *)&r,sizeof(Room),count,fpcustomer); fclose(fpcustomer);exit(0);}main(){fproom=fopen("room","wb");if(fproom!=NULL){for(i=0;i<count;i++){int id=100;r[i].m_num=i+100;r[i].m_floor=1;r[i].m_price=100;r[i].m_use=1;}fwrite((void *)&r,sizeof(Room),count,fproom); fclose(fproom);}else{printf("\n---文件打开失败--");}for(;;){printf("\n");printf("/******************************************\\\n");printf("**\n");printf("* 酒店管理系统*\n");printf("* 主菜单*\n");printf("**\n");printf("* 1.顾客登记*\n");printf("* 2.查询顾客信息*\n");printf("* 3.查询空房间*\n");printf("* 4.预订房间*\n");printf("* 5.退订房间*\n");printf("* 6.保存并退出系统*\n");printf("**\n");printf("\\******************************************/\n\n");printf("请输入选择项(1-6):");scanf("%d",&n);printf("\n\n\n\n");if(n>0&&n<=6){switch(n){case 1:Customer_Input();break;case 2:Customer_ListOut();break;/*查询顾客信息*/case 3:Room_ListOut();break;/*查询空房间*/case 4:PerCustomer_Search();break;/*预订房间*/case 5:UnCustomer_Out();break;/*退订房间*/case 6:Customer_Goaway(); /*保存退出*/}}else{printf("****************************************************** *****************\n");printf("**\n");printf("*输入错误! *\n");printf("*请退出! *\n");printf("**\n");printf("****************************************************** *****************\n");break;}}}。

相关文档
最新文档