Question
JAVA CODING PART A) Create a class named Apartment that holds an apartment number as aptNumber, number of bedrooms as bedrooms, number of baths as
JAVA CODING
PART A) Create a class named Apartment that holds an apartment number as aptNumber, number of bedrooms as bedrooms, number of baths as baths, and rent amount as rent.
Create the Apartment class.
Create the data fields for the Apartment class.
Create a default constructor that accepts no arguments and an overloaded constructor that accepts values for each data field
Create a default constructor and an overloaded constructor for the Apartment class.
Also create a get method for each field.
Create the get method for the aptNumber data field.
Create the get method for the bedrooms data field.
Create the get method for the baths data field.
Create the get method for the rent data field.
PART B) Write an application called TestApartments that creates at least five Apartment objects. Then prompt a 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 users criteria or an appropriate message if no such apartments are available.
Create the TestApartments class.
The TestApartments class accepts user input for an Apartment object.
An example of the program is shown below:
Enter minimum number of bedrooms needed >> 2 Enter minimum number of bathrooms needed >> 1.5 Enter maximum rent willing to pay >> 1200 Apartments meeting criteria of at least 2 bedrooms, at least 1.5 baths, and no more than $1200.0 rent: Apt #102 2 bedrooms, and 1.5 baths. Rent $775.0 Apt #103 3 bedrooms, and 2.0 baths. Rent $870.0 Apt #104 3 bedrooms, and 2.5 baths. Rent $960.0 Apt #105 3 bedrooms, and 3.0 baths. Rent $1100.0
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