Ask Question
3 May, 09:28

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. 3 May, 10:04
    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?
Find 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 you're in doubt about the correctness of the answers or there's no answer, then try to use the smart search and find answers to the similar questions.
Search for Other Answers