class Restaurant():
def __init__(self, restaurant_name, cuisine_type):
self.restaurant_name = restaurant_name
self.cuisine_type = cuisine_type
self.number_served = 0
def describe_restaurant(self):
print(self.restaurant_name.title() + ' : ' + self.cuisine_type + '.')
def open_restaurant(self):
print(self.restaurant_name.title() + " is opening!")
def number(self):
print("There are " + str(self.number_served) + " served!\n")
def set_number(self,number_served_reading):
self.number_served = number_served_reading
def increment_number_seved(self,increment_number):
self.number_served += increment_number
my_restaurant = Restaurant("YMZ",'Mingcai')
my_restaurant.describe_restaurant()
my_restaurant.open_restaurant()
my_restaurant.set_number(17)
my_restaurant.number()
my_restaurant.increment_number_seved(1)
my_restaurant.number()
your_restaurant = Restaurant("LF",'Anhuicai')
your_restaurant.describe_restaurant()
your_restaurant.open_restaurant()
your_restaurant.set_number(15)
your_restaurant.number()
your_restaurant.increment_number_seved(1)
your_restaurant.number()
his_restaurant = Restaurant("his",'Yuecai')
his_restaurant.describe_restaurant()
his_restaurant.open_restaurant()
his_restaurant.set_number(19)
his_restaurant.number()
his_restaurant.increment_number_seved(1)
his_restaurant.number()
9-4 就餐人数 :
最新推荐文章于 2023-07-28 16:20:01 发布