10-2Booking a hotel room

Suites 套房
in town到这个城市
availability可用空房情况n
Available空余的
check in入住
single room.单人间
superior在质量方面较好的
twin bed单人床
double bed双人床
reserve预定
buffet自助餐
complimentary免费的
Most expensive hotel rooms
在这里插入图片描述
最昂贵的酒店房间

Here is a list of some of the most expensive hotel rooms in the world.

以下列出了世界上最贵的旅馆房间名单。

Royal Penthouse Suite, Hotel President Wilson - Geneva, Switzerland. Price per night: $80,000

皇家阁楼套房,威尔逊总统酒店-日内瓦,瑞士。每晚价格:$8万

Grand Penthouse, The Mark Hotel - New York City. Price per night: $75,000

顶层豪华公寓,马克酒店 - 纽约。 每晚价格:$7.5万
Penthouse Suite, Grand Hyatt Cannes - France. Price per night: $41,000

顶层豪华套房,君悦戛纳 - 法国。每晚价格:$4.1万
Maharajah Pavilion, Raj Palace - India. Price per night: $65,000

maharajah pavilion, 拉杰宫殿酒店 - 印度。每晚价格:$6.5万

Sky Villa, Palms Casino Resort - Las Vegas. Price per night: $35,000

  空中别墅,棕榈赌场度假村- 拉斯维加斯。每晚价格:$3.5万

Source: https://www.time.com

  • 1
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
以下是实现你所需功能的示例代码,需要先安装 `mysql-connector-python` 库: ```python import mysql.connector from tkinter import * from datetime import datetime # Connect to MySQL database mydb = mysql.connector.connect( host="localhost", user="yourusername", password="yourpassword", database="db_hotel" ) # Create a cursor object mycursor = mydb.cursor() # Create a new table for storing reservations and checkouts mycursor.execute("CREATE TABLE IF NOT EXISTS reservations (rid INT AUTO_INCREMENT PRIMARY KEY, rtype VARCHAR(255), status VARCHAR(255), date_time DATETIME)") # Define function for booking a room def book_room(): # Retrieve the room type from the entry widget rtype = room_type_entry.get() # Check if a room of the specified type is available mycursor.execute("SELECT * FROM tab_room WHERE rtype=%s AND rstate=0", (rtype,)) room = mycursor.fetchone() if room: # Update the room state to reserved mycursor.execute("UPDATE tab_room SET rstate=1 WHERE rid=%s", (room[0],)) mydb.commit() # Add a new row to the reservations table mycursor.execute("INSERT INTO reservations (rtype, status, date_time) VALUES (%s, %s, %s)", (rtype, "reserved", datetime.now())) mydb.commit() # Display a success message status_label.config(text="Room reserved successfully at " + str(datetime.now())) else: # Display a failure message status_label.config(text="No available rooms of type " + rtype) # Define function for checking out a room def checkout_room(): # Retrieve the room type from the entry widget rtype = room_type_entry.get() # Check if a room of the specified type is reserved mycursor.execute("SELECT * FROM tab_room WHERE rtype=%s AND rstate=1", (rtype,)) room = mycursor.fetchone() if room: # Update the room state to vacant mycursor.execute("UPDATE tab_room SET rstate=0 WHERE rid=%s", (room[0],)) mydb.commit() # Add a new row to the reservations table mycursor.execute("INSERT INTO reservations (rtype, status, date_time) VALUES (%s, %s, %s)", (rtype, "checked out", datetime.now())) mydb.commit() # Display a success message status_label.config(text="Room checked out successfully at " + str(datetime.now())) else: # Display a failure message status_label.config(text="No reserved rooms of type " + rtype) # Create a Tkinter window root = Tk() # Create entry widget for room type room_type_entry = Entry(root) room_type_entry.grid(row=0, column=0) # Create button for booking a room book_button = Button(root, text="Book Room", command=book_room) book_button.grid(row=0, column=1) # Create button for checking out a room checkout_button = Button(root, text="Check Out Room", command=checkout_room) checkout_button.grid(row=1, column=1) # Create label for displaying status messages status_label = Label(root, text="") status_label.grid(row=2, column=0, columnspan=2) # Start the Tkinter event loop root.mainloop() # Print the reservations table mycursor.execute("SELECT * FROM reservations") reservations = mycursor.fetchall() for reservation in reservations: print(reservation) ``` 在这个例子中,我们首先创建了一个名为 `reservations` 的新表,用来存储预订和退房的信息。然后,我们定义了两个函数,一个用来预订房间,另一个用来退房。这些函数使用 `mysql.connector` 库与数据库交互,更新 `tab_room` 表中的状态,并将预订或退房的信息添加到 `reservations` 表中。最后,我们使用 Tkinter 创建了一个窗口,包含一个输入框和两个按钮,用来触发预订或退房操作。我们还在窗口中添加了一个标签,用来显示操作的结果。在程序结束后,我们从 `reservations` 表中检索数据,并将其打印到控制台上。请记得将代码中的“yourusername”和“yourpassword”替换为你自己的MySQL用户名和密码。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值