|
@ -24,8 +24,6 @@ class Property: |
|
|
beds=input("Enter number of bedrooms: "), |
|
|
beds=input("Enter number of bedrooms: "), |
|
|
baths=input("Enter number of baths: ")) |
|
|
baths=input("Enter number of baths: ")) |
|
|
|
|
|
|
|
|
#prompt_init = staticmethod(prompt_init) |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class Apartment(Property): |
|
|
class Apartment(Property): |
|
|
|
|
|
|
|
@ -33,7 +31,7 @@ class Apartment(Property): |
|
|
valid_laundries = ("coin", "ensuite", "none") |
|
|
valid_laundries = ("coin", "ensuite", "none") |
|
|
valid_balconies = ("yes", "no", "solarium") |
|
|
valid_balconies = ("yes", "no", "solarium") |
|
|
|
|
|
|
|
|
def __init__(self, balcony="", laundry="", **kwargs): |
|
|
|
|
|
|
|
|
def __init__(self, balcony = "", laundry = "", **kwargs): |
|
|
super().__init__(**kwargs) |
|
|
super().__init__(**kwargs) |
|
|
self.balcony = balcony |
|
|
self.balcony = balcony |
|
|
self.laundry = laundry |
|
|
self.laundry = laundry |
|
@ -58,6 +56,39 @@ class Apartment(Property): |
|
|
return parent_init |
|
|
return parent_init |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
class House(Property): |
|
|
|
|
|
|
|
|
|
|
|
# class variables |
|
|
|
|
|
valid_garage = ("attached", "detached", "none") |
|
|
|
|
|
valid_fenced = ("yes", "no") |
|
|
|
|
|
|
|
|
|
|
|
def __init__(self, num_stories = "", garage = "", fenced = "", **kwargs): |
|
|
|
|
|
super().__init__(**kwargs) |
|
|
|
|
|
self.garage = garage |
|
|
|
|
|
self.fenced = fenced |
|
|
|
|
|
self.num_stories = num_stories |
|
|
|
|
|
|
|
|
|
|
|
def display(self): |
|
|
|
|
|
super().display() |
|
|
|
|
|
print("HOSE DETAILS") |
|
|
|
|
|
print ("# of stories: {}".format(self.num_stories)) |
|
|
|
|
|
print ("garage: {}".format(self.garage)) |
|
|
|
|
|
print ("fenced yard: {}".format(self.fenced)) |
|
|
|
|
|
|
|
|
|
|
|
@staticmethod |
|
|
|
|
|
def prompt_init(): |
|
|
|
|
|
parent_init = Property.prompt_init() |
|
|
|
|
|
fenced = get_valid_input("Is the yard fenced?", House.valid_fenced) |
|
|
|
|
|
garage = get_valid_input("Is there a garage?", House.valid_garage) |
|
|
|
|
|
num_stories = input("How many stories? ") |
|
|
|
|
|
parent_init.update({ |
|
|
|
|
|
"fenced" : fenced, |
|
|
|
|
|
"garage" : garage, |
|
|
|
|
|
"num_stories" : num_stories |
|
|
|
|
|
}) |
|
|
|
|
|
return parent_init |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
def get_valid_input(input_string, valid_options): |
|
|
def get_valid_input(input_string, valid_options): |
|
|
input_string += " ({}) ".format(", ".join(valid_options)) |
|
|
input_string += " ({}) ".format(", ".join(valid_options)) |
|
|