From 84d8fe2598786eee34dd4d48e99aaa31c2a483f8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=94=90=E6=96=87=E9=9B=AF?= <3363402744@qq.com> Date: Mon, 27 May 2024 13:30:35 +0800 Subject: [PATCH] first commit --- tww.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 tww.py diff --git a/tww.py b/tww.py new file mode 100644 index 0000000..26c03b2 --- /dev/null +++ b/tww.py @@ -0,0 +1,25 @@ +import datetime +class Room: + def __init__(self, room_number, room_type, rate, availability=True): + self.room_number = room_number + self.room_type = room_type + self.rate = rate + self.availability = availability + +class Reservation: + def __init__(self, room, start_date, end_date): + self.room = room + self.start_date = start_date + self.end_date = end_date + self.total_cost = self.calculate_tatal_cost() + + def calculate_total_cost(self): + days = (self.end_date - self.start_date).days + return days * self.room.rate + +class Hotel: + def __init__(self, name): + self.name = name + self.rooms = [] + self.reservations = [] +