Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

For this assignment, you are required to complete two files (dwelling.py and pro

ID: 3761254 • Letter: F

Question

For this assignment, you are required to complete two files (dwelling.py and program111.py) provided in the zip named chapter11.zip. The dwelling.py file currently defines a Dwelling class and a subclass named House. This code is working. Your task here is to add two more subclasses (Apt and Condo) as described below. The program111.py file creates an instance of house and runs its str method. This also works. Your task in program111.py is to create instances of both new subclasses and display the status of each. Start by unzipping the zip file. Examine both files and execute program111.py to see how it runs. Class Apt: inherits from Dwelling and requires two more attributes: rent, a numeric attribute for monthly rent. terrace, a boolean attribute that is True for an apartment that has a terrace or balcony. requires a str method to display the status of an Apt instance (all attributes). Code as you see fit. Class Condo: also inherits from Dwelling and requires two additional attributes: mtce, a numeric attribute for the monthly maintenance. amenities, a string attribute listing Condo amenities such as pool, gym, etc. also requires a str method to display the status of a Condo instance (all attributes). Again, code as you wish. In program111.py, create instances of both new subclasses and display their attributes.

Explanation / Answer

#### dwelling.py

# defines classes Dwelling, House, Apt, and Condo

class Dwelling:

    def __init__(self,address,area,price):

        self.__address = address

        self.__area = area

        self.__price = price

    def get_address(self):

        return self.__address

    def get_area(self):

        return self.__area

    def get_price(self):

        return self.__price

    def set_price(self, price):

        self.__price = price

    def __str__(self):

        return self.__address + ', ' + str(self.__area) + ' sq ft, $' +     str(self.__price)

class House(Dwelling):

    def __init__(self,address,area,price,detached,storeys):

        Dwelling.__init__(self,address,area,price)

        self.__detached = detached

        self.__storeys = storeys

    def get_detached(self):

        return self.__detached

    def get_storeys(self):

        return self.__storeys

    def __str__(self):

        s = Dwelling.__str__(self)

        s += ' ' + 'Detached:' + str(self.__detached) + ', storeys:' +     str(self.__storeys)

        return s

### program111.py

import dwelling

def main( ):

    home = dwelling.House('102 Kalam Dr',3600,400000,True,4)

    print(home)

main( )

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote