From cf2141779b35c554737634fa94597d91549d498b Mon Sep 17 00:00:00 2001 From: cheeks <134818917+leftovertoast@users.noreply.github.com> Date: Sun, 2 Mar 2025 23:21:42 +0000 Subject: [PATCH] Completed 9-10 Imported Restaurant --- Chapter_09/9-10_imported_restaurant.py | 8 ++++++++ Chapter_09/restaurant.py | 14 ++++++++++++++ 2 files changed, 22 insertions(+) create mode 100644 Chapter_09/9-10_imported_restaurant.py create mode 100644 Chapter_09/restaurant.py diff --git a/Chapter_09/9-10_imported_restaurant.py b/Chapter_09/9-10_imported_restaurant.py new file mode 100644 index 0000000..8f087a1 --- /dev/null +++ b/Chapter_09/9-10_imported_restaurant.py @@ -0,0 +1,8 @@ +# Exercise 9-10 Imported Restaurant +# Learning Objective: Separate, import, and use a class + +from restaurant import Restaurant + +tonys_pizza = Restaurant("Tony's Pizza", "Pizzeria") + +tonys_pizza.describe_restaurant() \ No newline at end of file diff --git a/Chapter_09/restaurant.py b/Chapter_09/restaurant.py new file mode 100644 index 0000000..26278c6 --- /dev/null +++ b/Chapter_09/restaurant.py @@ -0,0 +1,14 @@ +class Restaurant: + def __init__(self, name, cuisine_type): + """Initialize variables name and cuisine_type, define functions to describe and to open restaurant...""" + + self.name = name + self.cuisine_type = cuisine_type + + def describe_restaurant(self): + """Describe the restaurant""" + print(f"The restaurant's name is {self.name} and the cuisine served here is {self.cuisine_type}") + + def open_restaurant(self): + """Simulate it being opened""" + print(f"{self.name} is now open for business.") \ No newline at end of file