1. Create a class Restaurant, the __init__ (self, Name, Country, City, BranchNumber, CuisineType) method for restaurant should store restaurant name, country, city, its branch number and cuisine type.
2. Create a method DescRestaurant that prints the name, Country, City, BranchNumber and Cuisine type of the restaurant.
3. Create a method RestaurantTiming, the method should print out the opening and closing time of the restaurant.
4. Create two instances of the class Restaurant with two different Names, Country, City, BranchNumber and CuisineType then call the DescRestaurant and RestaurantTiming method for each instance.
import time
class Restaurant:
def __init__(self, Name, Country, City, BranchNumber, CuisinType):
self._name = Name
self._country = Country
self._city = City
self._branch_number = BranchNumber
self._cuisin_type = CuisinType
self._openning = time.strptime("11:00:00", "%H:%M:%S")
#self._openning = time.struct_time(tm_hour=11, tm_min=0, tm_sec=0)
self._closing = time.strptime("00:00:00", "%H:%M:%S")
#self._closing = time.struct_time(tm_hour=23, tm_min=0, tm_sec=0)
def DescRestaurant(self):
print("Name:", self._name)
print("Country:", self._country)
print("Branch number:", self._branch_number)
print("Cuisine type:", self._cuisin_type)
def RestaurantTiming(self):
s = time.strftime("%H:%M", self._openning)
print("Openning:", s)
s = time.strftime("%H:%M", self._closing)
print("Closing:", s)
def main():
resto1 = Restaurant("Noma", "Denmark", "Copenhagen", 123, "New Nordic")
resto2 = Restaurant("Asado Etxebari", "Spain", "Atxondo", 987, "Local cuisine")
print("The best restaurant:")
resto1.DescRestaurant()
resto1.RestaurantTiming()
print("\nMy second favorite restaurant:")
resto2.DescRestaurant()
resto2.RestaurantTiming()
if __name__ == '__main__':
main()
Comments
Leave a comment