class Dog():
def __init__(self, name, age):
self.name = name
self.age = age
def sit(self):
print(self.name.title() + " is now sitting.")
def roll_over(self):
print(self.name.title() + " rolled over!")
class Restaurant():
def __init__(self, restaurant_name, cuisine_type):
self.name = restaurant_name
self.type = cuisine_type
def describe_restaurant(self):
print("name:"+self.name)
print("type:"+self.type)
def open_restaurant(self44):
print("status:open")
rest = Restaurant("PIZZA's Pizza", "Pizza")
print("Name:"+rest.name)
print("Type:"+rest.type)
rest.describe_restaurant()
rest.open_restaurant()
rest1 = Restaurant("KFC", "fastfood")
rest2 = Restaurant("MacDonald", "fastfood")
rest3 = Restaurant("Yanbian Noodle", "noodle")
rest1.describe_restaurant()
rest2.describe_restaurant()
rest3.describe_restaurant()
class User():
def __init__(self, first_name, last_name):
self.firstname = first_name
self.lastname = last_name
def describe_user(self):
print("first name:"+self.firstname)
print("last name:"+self.lastname)
def greet_user(self):
print("hello, "+self.firstname.title()+" " + self.lastname.title())
user1 = User("Tom","Jerry")
user2 = User("Zhang", "Yunyi")
user1.describe_user()
user1.greet_user()
user2.describe_user()
user2.greet_user()