Author Dusty Phillips Reviewers



Download 2,95 Mb.
Pdf ko'rish
bet90/183
Sana20.07.2022
Hajmi2,95 Mb.
#831085
1   ...   86   87   88   89   90   91   92   93   ...   183
Bog'liq
python3-oop

[
 84 
]
Finally, we'll need an 
Agent
object that holds a list of all properties, displays those 
properties, and allows us to create new ones. Creating properties will entail prompting 
the user for the relevant details for each property type. This could be done in the 
Agent
object, but then 
Agent
would need to know a lot of information about the types of 
properties. This is not taking advantage of polymorphism. Another alternative would 
be to put the prompts in the initializer or even a constructor for each class, but this 
would not allow the classes to be applied in a GUI or web application in the future. A 
better idea is to create a static method that does the prompting and returns a dictionary 
of the prompted parameters. Then, all the 
Agent
has to do is prompt the user for the 
type of property and payment method, and ask the correct class to instantiate itself.
That's a lot of designing! The following class diagram may communicate our design 
decisions a little more clearly:
Agent
+property_list
+list_properties(show_all=False)
+add_property(property_type,purchase_type)
Apartment
+balcony
+laundry
+display()
+prompt_init()
Property
+square_feet
+num_bedrooms
+num_bathrooms
+display()
+prompt_init()
House
+num_stories
+garage
+fenced_yard: boolean
+display()
+prompt_init()
Purchase
+price
+taxes
+display()
+prompt_init()
Rental
+furnished
+utilities
+rent
+display()
+prompt_init()
HouseRental
HousePurchase
ApartmentPurchase
ApartmentRental
www.it-ebooks.info


Chapter 3

Download 2,95 Mb.

Do'stlaringiz bilan baham:
1   ...   86   87   88   89   90   91   92   93   ...   183




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish