This commit is contained in:
marcel-dempers 2021-08-27 19:39:47 +10:00
parent ea0634f207
commit fdeec671de

View File

@ -1,6 +1,10 @@
def getCustomer(customerID): class Customer:
customer = getCustomers() def __init__(self, c="",f="",l=""):
return customer[customerID] self.customerID = c
self.firstName = f
self.lastName = l
def fullName(self):
return self.firstName + " " + self.lastName
def getCustomers(): def getCustomers():
customers = { customers = {
@ -13,21 +17,13 @@ def getCustomers():
"g": Customer("g", "Victor", "Savkov"), "g": Customer("g", "Victor", "Savkov"),
"h" : Customer("h", "Marcel", "Dempers") "h" : Customer("h", "Marcel", "Dempers")
} }
return customers return customers
class Customer: def getCustomer(customerID):
def __init__(self, c="", f="", l=""): customer = getCustomers()
self.customerID = c return customer[customerID]
self.firstName = f
self.lastName = l
def fullName(self):
return self.firstName + " " + self.lastName
customers = getCustomers() customers = getCustomers()
for customerID in customers: for customerID in customers:
print(customers[customerID].fullName()) print(customers[customerID].fullName())