Answered step by step
Verified Expert Solution
Question
1 Approved Answer
using java post question 1 and 2 seperately please Problem 1 A. Create the class Apartment. An apartment object has a number (String), number of
using java post question 1 and 2 seperately please
Problem 1 A. Create the class Apartment. An apartment object has a number (String), number of bedrooms rooms (int), and an area (double). Create the default and initialization constructors, setters, getters, and toString() method. B. Create the class Building. A Building object has an address (String), and an array of Apartment objects. Create the initialization constructor that takes a String for the address, setters, getters, and toString() method. C. In the Building class, create a method "fillApartmentArray(" that opens the input file "Apartments.info, reads the number of apartments from the file and fill the array with the apartment information of each apartment. D. Create a class TestBuilding with a main method. In the main method, create an object of type Building. It has the address 50 Al Karamah St. Abu Dhabi. E. Call the method to fill the apartment array from the input file. F. Display the apartment with the largest area. G. Count and display the number of apartment objects with 2 or more bedrooms. Display them using the toString() method. Sample input file: 6 Al 2 200 A2 1 150 A3 2 250 B1 1 100 B2 1 90 B3 2 220 Problem 3: Solve Problem 1 again using an Array list of Apartment objects instead of Array of Apartment objects in the Building classStep 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