We are hungry college students, and we are developing an app to help us find the closest restaurants, in restaurant.py. Your job is to implement the functions below that represent the restaurant abstract data type.
A restaurant is an abstract data type that has a name, a longitude coordinate, and a latitude coordinate. We create a restaurant like this:
#Creating Constructor object and functions
class restaurants:
def __init__(self, name, longitude, latitude):
self.name = name.lower()
self.longitude = longitude
self.latitude = latitude
def get_name(self):
return self.name
def get_longitude(self):
return self.longitude
def get_latitude(self):
return self.latitude
#Creating a new object
mac = restaurants("McDonald's", 73.843918, 18.517768)
mac.get_name()
Comments
Leave a comment