Create a class named Apartment that holds an apartment number, number of bedrooms, number of baths, and rent amount.

Python

Part 1 (15pts): Create a class named Apartment that holds an apartment number, number of bedrooms, number of baths, and rent amount.

Include the following in the class:

Create a constructor that accepts values for each data field (apartment number, number of bedrooms, number of baths, and rent amount).

Create instance variables in the constructor that correspond to each data field passed to the constructor. Set each instance variable to the value of the corresponding data field passed in

Create a get method for each field.

Add a calculate_rent method to the class. The method takes the number of years as parameter.  It calculates and displays the total rent for the number of years passed into the method

 

Create a class named Apartment that holds an apartment number, number of bedrooms, number of baths, and rent amount.
Scroll to top