Question
Create a Python Program: Create a class named Apartment that holds an apartment number, number of bedrooms, number of baths, and rent amount. Create a
Create a Python Program: 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 of the data fields. Also, create a get method for each field. Write an application that creates at least five Apartment objects (The data to create the Apartment objects will come from a file). Then prompt the user to enter a minimum number of bedrooms required, a minimum number of baths required, and a maximum rent the user is willing to pay. Display data for all the Apartment objects that meet the user's criteria or an appropriate message if no such apartments are available. Note: Include the following error checking in your program 1. Apartment number, rent amount, number of bedrooms, and number of baths must be a positive numeric values. If the user enters a negative or non-numeric value, the program should handle the error by either discarding all the values entered and prompting for all new values or only discard the bad value and prompt the user to enter a new value.
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started