Ask Question
13 December, 08:01

Create a class named Apartment that holds an apartment number, number of bedrooms, number of baths, and rent amount. Create a constructor that accepts values for each data field. Also create a get method for each field. Write an application that creates at least five Apartment objects

+3
Answers (1)
  1. 13 December, 08:47
    0
    Create a class named Apartment that holds an apartment number, number of bedrooms, number of baths, and rent amount. Create a constructor that accepts values for each data field. Also create a get method for each field. Application is written in the following way.

    Explanation:

    Potential Input: 1000, 1, 1

    Desired Output:

    Aparment# Rent Rooms Bathrooms

    111 1000 1 '1

    class Apartments:

    def __init__ (self, apartNum, rent, rooms, bath):

    self. apartNum=apartNum

    self. rent=rent

    self. rooms=rooms

    self. bath=bath

    def setRent (self, aRent):

    self. rent1 = aRent

    def getRent (self):

    return self. aRent

    def setRoom (self, rooms):

    self. room = rooms

    def getRoom (self):

    return self. rooms

    def setBath (self, baths):

    self. bath = baths

    def getBath (self):

    return self. baths

    apt_1 = Apartments (111,1000,1,1)

    apt_2 = Apartments (112,2000,2,1)

    apt_3 = Apartments (113,2500,2,2)

    apt_4 = Apartments (114,3000,3,2)

    apt_5 = Apartments (115,3500,3,3)

    rentInput=input ('Enter maximum amount of rent: ')

    roomInput=input ('Enter minimum number of bedrooms: ')

    bathInput=input ('Enter minimum number of baths: ')
Know the Answer?
Not Sure About the Answer?
Get an answer to your question ✅ “Create a class named Apartment that holds an apartment number, number of bedrooms, number of baths, and rent amount. Create a constructor ...” in 📙 Social Studies if there is no answer or all answers are wrong, use a search bar and try to find the answer among similar questions.
Search for Other Answers