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

合集下载

酒店管理系统代码(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]。

酒店管理系统c语言程序设计

酒店管理系统c语言程序设计

酒店管理系统c语言程序设计以下是一个简单的酒店管理系统的 C 语言程序设计示例,包括了客户入住、退房和查询房间状态等基本功能。

请注意,这只是一个简化的示例,实际的酒店管理系统可能需要更多的功能和复杂的逻辑。

```c#include <stdio.h>#include <stdlib.h>#include <string.h>#define MAX_ROOMS 100#define MAX_CUSTOMERS 100// 房间结构体struct Room {int roomNumber;int isOccupied;int customerID;};// 客户结构体struct Customer {int customerID;char customerName[50];};// 房间列表struct Room rooms[MAX_ROOMS];// 客户列表struct Customer customers[MAX_CUSTOMERS];// 初始化房间列表void initRooms() {for (int i = 0; i < MAX_ROOMS; i++) {rooms[i].roomNumber = i + 1;rooms[i].isOccupied = 0;rooms[i].customerID = 0;}}// 初始化客户列表void initCustomers() {for (int i = 0; i < MAX_CUSTOMERS; i++) {customers[i].customerID = i + 1;strcpy(customers[i].customerName, "Customer");}}// 查找空闲房间int findFreeRoom() {for (int i = 0; i < MAX_ROOMS; i++) {if (rooms[i].isOccupied == 0) {return i;}}return -1;}// 客户入住void checkIn(int customerID, int roomNumber) {int freeRoom = findFreeRoom();if (freeRoom != -1) {rooms[freeRoom].isOccupied = 1;rooms[freeRoom].customerID = customerID;printf("Customer %d checked in to Room %d\n", customerID, roomNumber); } else {printf("No free rooms available\n");}}// 客户退房void checkOut(int roomNumber) {for (int i = 0; i < MAX_ROOMS; i++) {if (rooms[i].roomNumber == roomNumber && rooms[i].isOccupied == 1) { rooms[i].isOccupied = 0;rooms[i].customerID = 0;printf("Customer checked out of Room %d\n", roomNumber);return;}}printf("Room not found\n");}// 查询房间状态void viewRoomStatus(int roomNumber) {for (int i = 0; i < MAX_ROOMS; i++) {if (rooms[i].roomNumber == roomNumber) {if (rooms[i].isOccupied == 1) {printf("Room %d is occupied by Customer %d\n", roomNumber, rooms[i].customerID);} else {printf("Room %d is vacant\n", roomNumber);}return;}}printf("Room not found\n");}// 主函数int main() {initRooms();initCustomers();int choice;while (1) {printf("1. Check In\n2. Check Out\n3. View Room Status\n4. Exit\n"); scanf("%d", &choice);switch (choice) {case 1:int customerID, roomNumber;printf("Enter customer ID: ");scanf("%d", &customerID);printf("Enter room number: ");scanf("%d", &roomNumber);checkIn(customerID, roomNumber);break;case 2:printf("Enter room number: ");scanf("%d", &roomNumber);checkOut(roomNumber);break;case 3:printf("Enter room number: ");scanf("%d", &roomNumber);viewRoomStatus(roomNumber);break;case 4:exit(0);break;default:printf("Invalid choice\n");}}return 0;}```上述代码实现了一个简单的酒店管理系统,包括客户入住、退房和查询房间状态等功能。

(完整版)C语言酒店管理系统

(完整版)C语言酒店管理系统
}
for(y=0;y<5;y++)
{
if(room[x][y]==0)
{
printf("空%d-%d |",x+1,y+1);
}else
{
printf("住%d-%d |",x+1,y+1);
}
if(y+1==5)
{
if(x+1==1||x+1==2)
printf("该层标间均50元");
else
printf("该层标间均100元");
printf("\t2.查询房间的入住情况\n");
printf("\t3.查询当前费用\n");
printf("\t4.结账退房\n");
printf("\t5.退出程序\n");
}
void hotel_execute();
void hotel_select();
void hotel_outhotel();
{
printf("|-------|--------|--------|--------|--------|--------|\n|第%d层|",x+|-------|--------|--------|--------|--------|--------|\n|第%d层|",x+1);
}
}
}
printf("\n|-------|--------|--------|--------|--------|--------|\n");

酒店管理系统C语言版

酒店管理系统C语言版

#i n c l u d e<s t d i o.h>#include<stdlib.h>struct peopledata{char name[11];char sex[3];int age;int idcard[2];};struct datefflush(stdin);printf("房间类型:");scanf("%c",&room.kind);printf("住宿人员信息:\n");printf("\t\t姓名:");fflush(stdin);scanf("%s",);fflush(stdin);printf("\t\t性别:");gets(room.people.sex);printf("\t\t年龄:");scanf("%d",&room.people.age);printf("\t\t请输入身份证号码:");for(i=0;i<2;i++)scanf("%d",&room.people.idcard[i]); printf("入住时间:\n");printf("\t\t年:");scanf("%d",&room.time.year);printf("\t\t月:");scanf("%d",&room.time.month);printf("\t\t日:");scanf("%c",&tag);fflush(stdin);}else{printf("要继续添加吗?(y/n)\n");scanf("%c",&tag);fflush(stdin);}}fclose(fp);} while(tag=='y');}void updata(){FILE *fp;rooms room;int number,i;printf("请输入要更新的信息的房间编号:\n");scanf("%d",&number);printf("\t\t姓名\t性别\t年龄");printf("\t\t%s\t%s\t%d\n",,room.people.sex,room.people.age);printf("身份证号:");for(i=0;i<2;i++)printf("%d",room.people.idcard[i]);putchar('\n');printf("入住时间:\n");printf("%d年%d月%d日\n",room.time.year,room.time.month,room.time.day);printf("入住时长:\n");printf("%d天\n",room.time.time);printf("\t————————————————\n");printf("*******************************************************\n");printf("请输入更新信息:\n");printf("房间编号:");scanf("%d",&room.number);fflush(stdin);printf("房间类型:");scanf("%c",&room.kind);printf("住宿人员信息:\n");printf("\t\t姓名:");fflush(stdin);void searchdata(){FILE *fp;rooms room;int number,i;printf("请输入要查询的信息的房间编号:\n");scanf("%d",&number);if((fp=fopen("d:\\酒店住宿登记表.txt","r+"))==NULL){printf("打开文件”酒店住宿登记表“失败,按任意键退出。

酒店管理系统代码

酒店管理系统代码

附录Base.Dlg.cpp程序:#include "stdafx.h"#include "MyPos.h"#include "BaseDlg.h"#include "MaterielDlg.h"#include "ClassDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CBaseDlg dialogCBaseDlg::CBaseDlg(CWnd* pParent /*=NULL*/): CDialog(CBaseDlg::IDD, pParent){//{{AFX_DATA_INIT(CBaseDlg)// NOTE: the ClassWizard will add member initialization here //}}AFX_DATA_INIT}void CBaseDlg::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CBaseDlg)DDX_Control(pDX, IDC_TAB_BASE, m_oTabBase);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CBaseDlg, CDialog)//{{AFX_MSG_MAP(CBaseDlg)//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CBaseDlg message handlersBOOL CBaseDlg::OnInitDialog(){CDialog::OnInitDialog();// TODO: Add extra initialization herem_oTabBase.AddPage("商品类别", &m_oClassdlg, IDD_DIALOG_CLASS);m_oTabBase.AddPage("商品资料", &m_oMaterieldlg, IDD_DIALOG_MA TERIEL);m_oTabBase.AddPage("付款方式", &m_oPaymodedlg, IDD_DIALOG_PAYMODE);m_oTabBase.Show();return TRUE; // return TRUE unless you set the focus to a control// EXCEPTION: OCX Property Pages should return FALSE}CallDlg.cpp程序:#include "stdafx.h"#include "MyPos.h"#include "CallDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CCallDlg dialogextern CMyPosApp theApp;CCallDlg::CCallDlg(CWnd* pParent /*=NULL*/): CDialog(CCallDlg::IDD, pParent){//{{AFX_DATA_INIT(CCallDlg)// NOTE: the ClassWizard will add member initialization here//}}AFX_DATA_INIT}void CCallDlg::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CCallDlg)DDX_Control(pDX, IDC_STATIC_CALL, m_oCallstatic);DDX_Control(pDX, IDC_EDIT_CALLBILLID, m_oCallbillid);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CCallDlg, CDialog)//{{AFX_MSG_MAP(CCallDlg)//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CCallDlg message handlersvoid CCallDlg::OnOK(){if(dowhat=="imhappy"){theApp.scallid="";m_oCallbillid.GetWindowText(theApp.scallid);}if(dowhat=="pleased")m_oCallbillid.GetWindowText(dowhat);CDialog::OnOK();}BOOL CCallDlg::OnInitDialog(){CDialog::OnInitDialog();if(dowhat=="pleased")m_oCallstatic.SetWindowText("请输入桌号:");return TRUE; // return TRUE unless you set the focus to a control// EXCEPTION: OCX Property Pages should return FALSE }CheckDlg.cpp程序:#include "stdafx.h"#include "MyPos.h"#include "CheckDlg.h"#include "PosDlg.h"#ifdef _DEBUG#define new DEBUG_NEW#undef THIS_FILEstatic char THIS_FILE[] = __FILE__;#endif/////////////////////////////////////////////////////////////////////////////// CCheckDlg dialogextern CMyPosApp theApp;CCheckDlg::CCheckDlg(CWnd* pParent /*=NULL*/): CDialog(CCheckDlg::IDD, pParent){//{{AFX_DATA_INIT(CCheckDlg)//}}AFX_DATA_INIT}void CCheckDlg::DoDataExchange(CDataExchange* pDX){CDialog::DoDataExchange(pDX);//{{AFX_DATA_MAP(CCheckDlg)DDX_Control(pDX, IDC_EDIT_CONSUME, m_oConsume);DDX_Control(pDX, IDC_EDIT_CDISCOUNT, m_oCdiscount);DDX_Control(pDX, IDC_EDIT_RECEIVE, m_oReceive);DDX_Control(pDX, IDC_EDIT_CHANGE, m_oChange);DDX_Control(pDX, IDC_EDIT_TOTALM, m_oTotalm);DDX_Control(pDX, IDC_COMBO_PAYMODE, m_oCombopay);DDX_Control(pDX, IDC_LIST_CHECKLIST, m_oChecklist);//}}AFX_DATA_MAP}BEGIN_MESSAGE_MAP(CCheckDlg, CDialog)//{{AFX_MSG_MAP(CCheckDlg)ON_BN_CLICKED(IDC_BUTTON_CHECKOK, OnButtonCheckok)ON_EN_CHANGE(IDC_EDIT_RECEIVE, OnChangeEditReceive)ON_NOTIFY(NM_CLICK, IDC_LIST_CHECKLIST, OnClickListChecklist) ON_EN_CHANGE(IDC_EDIT_CDISCOUNT, OnChangeEditCdiscount)ON_BN_CLICKED(IDC_BUTTON_RF, OnButtonRf)ON_BN_CLICKED(IDC_BUTTON_HANG, OnButtonHang)//}}AFX_MSG_MAPEND_MESSAGE_MAP()/////////////////////////////////////////////////////////////////////////////// CCheckDlg message handlersBOOL CCheckDlg::OnInitDialog(){CDialog::OnInitDialog();//设置list控件的文字和背景颜色m_oChecklist.SetBkColor(RGB(255,255,255));m_oChecklist.SetTextBkColor(RGB(161,223,212));//清空list控件的数据for(int delcolumn=100;delcolumn>=0;delcolumn--)m_oChecklist.DeleteColumn(delcolumn);//设置list对话框的列DWORD dwStyle;RECT rect;LV_COLUMN lvc;dwStyle = m_oChecklist.GetStyle();dwStyle |= LVS_EX_GRIDLINES |LVS_EX_FULLROWSELECT|LVS_SHOWSELALWAYS ;m_oChecklist.SetExtendedStyle(dwStyle);m_oChecklist.GetClientRect(&rect);lvc.mask = LVCF_TEXT | LVCF_SUBITEM | LVCF_WIDTH |LVCF_FMT;lvc.fmt=LVCFMT_LEFT;lvc.iSubItem = 0;lvc.pszText = _T("商品类别");lvc.cx = 110;m_oChecklist.InsertColumn(1,&lvc);lvc.iSubItem = 1;lvc.pszText = _T("消费金额");lvc.cx = 90;m_oChecklist.InsertColumn(2,&lvc);lvc.iSubItem = 2;lvc.pszText = _T("可折扣金额");lvc.cx = 90;m_oChecklist.InsertColumn(3,&lvc);lvc.iSubItem = 3;lvc.pszText = _T("折扣%");lvc.cx = 60;m_oChecklist.InsertColumn(4,&lvc);lvc.iSubItem = 4;lvc.pszText = _T("结帐金额");lvc.cx = 90;m_oChecklist.InsertColumn(5,&lvc);//Add paymode to combobox._RecordsetPtr m_pRecordset;CString sql="select * from PAYMODE";try{m_pRecordset.CreateInstance("ADODB.Recordset");m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),a dOpenStatic,adLockOptimistic,adCmdText);while(!m_pRecordset->adoEOF){m_oCombopay.AddString((LPCTSTR)(_bstr_t)m_pRecordset->GetCollect("NAME"));m_pRecordset->MoveNext();}m_pRecordset->Close();m_oCombopay.SetCurSel(0);//Select the 1st string of combobox.}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]读取付款方式到组合框出错:%s",e.ErrorMessage());AfxMessageBox(temp);}//Read class consume to list.ReadtoList(theApp.scallid);//Sum bill Items money from database.CString stotal;float ftotal=0;sql="Select SUM(ITEMTOTAL) as SSS from SALEDETAIL where BILLID='"+theApp.scallid+"'";try{m_pRecordset.CreateInstance("ADODB.Recordset");m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),a dOpenStatic,adLockOptimistic,adCmdText);_variant_t vtemp = m_pRecordset->GetCollect("SSS");if(vtemp.dblVal>0)ftotal=(float)m_pRecordset->GetCollect("SSS");elseftotal=0;stotal.Format("%.2f",ftotal);m_oTotalm.SetWindowText(stotal);m_oConsume.SetWindowText(stotal);}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]计算单据商品金额出错:%s",e.ErrorMessage());AfxMessageBox(temp);}return TRUE; // return TRUE unless you set the focus to a control// EXCEPTION: OCX Property Pages should return FALSE}void CCheckDlg::OnButtonCheckok(){CString stotal,sbilltotal,spayID,sql,spaymode,snowtime;long lpayID;_RecordsetPtr m_pRecordset;m_oConsume.GetWindowText(stotal);m_oTotalm.GetWindowText(sbilltotal);int nselect=m_oCombopay.GetCurSel();m_oCombopay.GetLBText(nselect,spaymode);lpayID=GetPaymodeID(spaymode);spayID.Format("%d",lpayID);if(fchange<0)return;//得到系统时间CTime now=CTime::GetCurrentTime();snowtime=now.Format(_T("%Y-%m-%d %H:%M:%S"));sql="Update SALEBILL set ENDDATE='"+snowtime+"',SALES='"++"',TOTAL="+stotal+",ACTTOTAL="+sbilltotal+",STATUS='已结帐',PAYMODE="+spayID+" where ID='"+theApp.scallid+"'";try{_variant_t RecordsAffected;theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]单据头更新数据库出错:%s",e.ErrorMessage());AfxMessageBox(temp);return;}//output the checkout time and paymode to the print.theApp.snowtimep=snowtime;theApp.spaymodep=spaymode;theApp.sconsume=stotal;theApp.sactsum=sbilltotal;//Insert data into PAYDETAIL.CString sclass,scontotal,sdiscount,sacttotal,svaltotal;int nItemCount=m_oChecklist.GetItemCount();//表项总数for(int i=0;i<nItemCount;i++){sclass=m_oChecklist.GetItemText(i,0);scontotal=m_oChecklist.GetItemText(i,1);sdiscount=m_oChecklist.GetItemText(i,3);sacttotal=m_oChecklist.GetItemText(i,4);float fvaltotal=atof(scontotal)-atof(sacttotal);svaltotal.Format("%.2f",fvaltotal);sql="Insert into PAYDETAIL(BILLID,CLASS,TOTAL,DISCOUNT,ACTTOTAL,VALTOTAL)values('"+theApp.scallid+"','"+sclass+"',"+scontotal+",'"+sdiscount+"',"+sacttotal+","+svaltotal+")";try{_variant_t RecordsAffected;theApp.m_pConnection->Execute((_bstr_t)sql,&RecordsAffected,adCmdText);}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]付款明细(PAYDETAIL)插入数据出错:%s",e.ErrorMessage());AfxMessageBox(temp);return;}}//When the check button is click down,send a message(WM_CHECKOUT) to the CPosDlg.LRESULT Res=::SendMessage(theApp.pWnd, WM_CHECKOUT, 0, 0);CDialog::OnOK();}long CCheckDlg::GetPaymodeID(CString payname){long paymodeID;_RecordsetPtr m_pRecordset;CString sql="Select * from PAYMODE where NAME='"+payname+"'";try{m_pRecordset.CreateInstance("ADODB.Recordset");m_pRecordset->Open((_variant_t)sql,_variant_t((IDispatch*)theApp.m_pConnection,true),a dOpenStatic,adLockOptimistic,adCmdText);paymodeID=(long)m_pRecordset->GetCollect("ID");}catch(_com_error e)///捕捉异常{CString temp;temp.Format("[结帐]获取付款方式ID出错:%s",e.ErrorMessage());AfxMessageBox(temp);}return paymodeID;}void CCheckDlg::OnChangeEditReceive(){// TODO: If this is a RICHEDIT control, the control will not// send this notification unless you override the CDialog::OnInitDialog()// function and call CRichEditCtrl().SetEventMask()// with the ENM_CHANGE flag ORed into the mask.CString sreceive,schange,stotal;m_oChange.SetWindowText("");m_oReceive.GetWindowText(sreceive);m_oTotalm.GetWindowText(stotal);fchange=atof(sreceive)-atof(stotal);if(fchange>=0){schange.Format("%.2f",fchange);m_oChange.SetWindowText(schange);}}void CCheckDlg::ReadtoList(CString sbillid){_RecordsetPtr m_pRecordset; //Must define it in functionCString sql,sclassname,sclassname1,sctotal;long lclassid;float fctotal=0;sql="Select Sum(ITEMTOTAL) as XXX,CLASSID from SALEDETAIL where BILLID='"+sbillid+"' group by CLASSID ";//删除所有list中的数据。

C语言宾馆管理系统源代码

C语言宾馆管理系统源代码
}
else
{
printf("要删除的话就按1:");
scanf("%d",&i);
if(i==1)
{
q=head;
while(q!=NULL&&q->next!=p)
q=q->next;
q->next=p->next;
}
while(b--)
{
p=(listnode *)malloc(sizeof(listnode));
printf("姓名 性别 证件 入住 天数 房号 标准 价格 预收 押金 离开 备注\n");
printf("**********************************************************************\n");
printf("*******************************************\n");
printf("姓名查找,按1表示查找:");
p=head->next;
scanf("%d",&i);
if(i==1)
{
printf("请输入要查询的姓名:");
scanf("%s",&come);
while(p&&strcmp(p->e,come)<0)
p=p->next;
if(p==NULL||strcmp(p->e,come)>0)

简易酒店管理系统代码

简易酒店管理系统代码#include#include#include#include//时间函数的定义struct tm *localtime(const time_t * timep);//时间的初始化char *wday[]={"星期天","星期⼀","星期⼆","星期三","星期四","星期五","星期六"}; time_t timep;struct tm *now;struct tm *after;// time(&timep);//酒店房间的定义struct house{char house_number[10];char house_shape[2];float house_price;int sum_person;// struct house *next;}h[10]={{"101","1",200.0,0},{"102","1",200.0,0},{"103","1",200.0,0},{"104","2",150.0,0},{"105","2",150.0,0},{"106","3",100.0,0},{"107","1",200.0,0},{"108","2",150.0,0},{"109","3",100.0,0},{"110","1",200.0,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.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房间里是否有家具损坏:");。

酒店管理系统c语言

酒店管理系统1. 引言酒店管理系统是一种用于管理酒店日常运营的软件系统。

它可以帮助酒店管理人员提高工作效率,提供优质的服务,实现酒店的可持续发展。

本文将介绍一个基于C 语言开发的酒店管理系统,包括系统的功能设计、数据库设计、用户界面设计以及系统测试等内容。

2. 功能设计2.1 客房管理客房管理是酒店管理系统最重要的功能之一。

在该功能下,可以实现以下操作:•客房信息录入:输入客房号码、类型、价格等信息。

•客房信息查询:根据客房号码或类型查询客房信息。

•客房信息修改:修改客房的价格、状态等信息。

•客房状态查询:查询客房的入住状态。

2.2 预订管理预订管理是指对客户预订酒店客房的操作。

在该功能下,可以实现以下操作:•房间预订:根据客户需求,预订适合的客房。

•预订查询:查询已预订的客房信息。

•预订取消:取消已预订的客房。

2.3 入住管理入住管理是指客户入住酒店的操作。

在该功能下,可以实现以下操作:•入住登记:输入客户信息,将客户分配到合适的客房。

•入住查询:查询已入住客房的信息。

•退房办理:将已入住客房标记为可用状态。

2.4 结算管理结算管理是指对客户住宿费用进行结算的操作。

在该功能下,可以实现以下操作:•账单生成:根据客户入住情况,生成相应的账单。

•账单查询:查询客户的消费情况。

•结算处理:对客户账单进行结算。

3. 数据库设计酒店管理系统需要使用数据库来存储和管理数据。

以下是数据库设计的关键表格:3.1 客房信息表字段名类型描述RoomID int 客房号码RoomType varchar 客房类型Price float 客房价格Status int 客房状态CreateTime date 创建时间3.2 预订信息表字段名类型描述ReservationID int 预订号码CustomerID int 客户号码RoomID int 客房号码CheckInDate date 入住日期CheckOutDate date 退房日期3.3 入住信息表字段名类型描述CheckInID int 入住号码CustomerID int 客户号码RoomID int 客房号码CheckInDate date 入住日期3.4 账单信息表字段名类型描述BillID int 账单号码CustomerID int 客户号码RoomID int 客房号码TotalAmount float 总金额4. 用户界面设计用户界面是酒店管理系统与用户进行交互的重要环节。

C语言实现酒店管理系统

C语言实现酒店管理系统这篇文章主要为大家详细介绍了C语言实现酒店管理系统,文中示例代码介绍的非常详细,具有一定的参考价值,感兴趣的小伙伴们可以参考一下:源码如下:#include<bits/stdc++.h>#include<conio.h>#include <windows.h>#include<string.h>#include<time.h>#define NUM 1000 //控制房间个数int j;void LoginRoom();//登记房屋void SearchRoom();//搜寻房屋void ChangeRoom();//更换住房void OutRoom();//退房void save();//保存信息void load();//载入信息//struct Totalstruct Total{char Name[20];int Sex;int Age;char IDcard[18];int hour;int xx;int yy;int zz;};struct room{int RoomID;char Tel[11];long Price;int Sign;int feiyong;//struct Date Datesum;struct Total Totallist;}Room[NUM];// 将房间个数写入信息void LoginRoom() //登记,注册客房信息函数{int i,n,k;n=0;system("cls");printf(" 用户登记\n");for(k=0;k<=1000;k++){printf("请输入客房号:\n");scanf("%d",&i);if(Room[i-1].Sign==1){printf("对不起,该房间已入住,请重新输入。

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

#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++){{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].nameOne,name);roomArray[i].sexOne = sex;roomArray[i].Count++;system("cls");printf("客人已经成功入住,在房间%d",roomArray[i].roomNumber);return;;}}printf("无法入住,房间已经住满或者是没有适合的房间");}void fun2() //退房操作{int i;char name[20];printf("请输入要退房旅客的姓名:");scanf("%s",name);for(i=0;i<5;i++){if(strcmp(roomArray[i].nameOne,name) == 0){memset(roomArray[i].nameOne,0,20);roomArray[i].Count--;system("cls");printf("%s客人已经成功退房\n",name);return;}if(strcmp(roomArray[i].nameTwo,name) == 0){memset(roomArray[i].nameTwo,0,20);roomArray[i].sexTwo = 0;roomArray[i].Count--;system("cls");printf("%s客人已经成功退房\n",name);return;}}system("cls");printf("没有名为%s的客人,请检查输入的正确性!\n",name);}void fun3() //查询操作{int index;int i;char name[20];int number;int j;system("cls");printf("***************请选择要查询的种类***************\n");printf(" 1.所有房间入住信息显示\n");printf(" 2.按照姓名查询\n");printf(" 3.按照房号查询\n");scanf("%d",&index);if(index == 1){for( i=0;i<5;i++){printf("房间%d:",roomArray[i].roomNumber);if(roomArray[i].Count == 0){printf("没有客人入住\n");}else if(roomArray[i].Count == 1){if(roomArray[i].sexTwo == 0){printf("当前有1位客人-> 姓名%s,",roomArray[i].nameOne);if(roomArray[i].sexOne == 1)printf("性别:男");else if(roomArray[i].sexOne == -1)printf("性别:女");printf("\n");}else if(roomArray[i].sexOne == 0){printf("当前有1位客人-> 姓名%s,",roomArray[i].nameTwo);if(roomArray[i].sexTwo == 1)printf("性别:男");else if(roomArray[i].sexTwo == -1)printf("性别:女");printf("\n");}}else{//printf("当前有两个客人客人1:姓名%s,性别%d 客人2:姓名%s,性别%d \n",roomArray[i].nameOne,roomArray[i].sexOne,roomArray[i].nameTwo,roomArray[i].sexTwo);printf("当前有2位客人-> 姓名%s,",roomArray[i].nameOne);if(roomArray[i].sexOne == 1)printf("性别:男,");else if(roomArray[i].sexOne == -1)printf("性别:女,");printf("姓名:%s,",roomArray[i].nameTwo);if(roomArray[i].sexTwo == 1)printf("性别:男,");else if(roomArray[i].sexOne == -1)printf("性别:女,");printf("\n");}}}else if(index == 2){printf("请输入你要查询房客的姓名:");scanf("%s",name);for(i=0;i<5;i++){if(strcmp(roomArray[i].nameOne,name) == 0 || strcmp(roomArray[i].nameTwo,name) == 0){printf("%s房客入住在房间%d!\n",name,roomArray[i].roomNumber);return;}}printf("没有找到该旅客的信息!");}else if(index == 3){printf("请输入你要查询的房间号:");scanf("%d",&number);j = number - 301;if(roomArray[j].Count == 0){printf("没有客人入住\n");}else if(roomArray[j].Count == 1){printf("当前有1位客人-> 姓名%s,性别%d!",roomArray[j].nameOne,roomArray[j].sexOne);}else{printf("当前有两个客人入住姓名%s,性别%d 姓名%s,性别%d \n",roomArray[j].nameOne,roomArray[j].sexOne,roomArray[j].nameTwo,roomArray[j].sexTwo);}}}void show(){system("color 9f");printf("*******************请选择操作************************\n");printf(" 1.旅客入住\n");printf(" 2.旅客退房\n");printf(" 3.信息查询\n");printf(" 4.退出exit\n");printf("请输入你要选择的操作:");}int main(){int i= 100;InitArray();printf("*******************宾馆信息管理软件*******************\n");while(i != 4){printf("\n");show();scanf("%d",&i);switch(i){case 1:fun1();break;case 2:fun2();break;case 3:fun3();break;}}system("pause");return 0;。

相关文档
最新文档