Question
Roberto has purchased buildings that contain apartments to rent. Create an Apartment class that contains fields for the street address, apartment number, monthly rent amount,
Roberto has purchased buildings that contain apartments to rent. Create an Apartment class that contains fields for the street address, apartment number, monthly rent amount, and number of bedrooms for each Apartment that he owns. Include a constructor that assigns field values to the class, a toString() method that displays the Apartment values, and a compareTo() method that compares Apartment objects based on the rent value. Include any other methods that you think you might need. Save the file as Apartment.java.
Write an application that contains a LinkedList in which to store Apartment objects. Prompt the user for values for Apartments and add them to the LinkedList until a sentinel value is entered. Sort the Apartments by rent value, and then display the sorted list. Save the file as ApartmentsLinkedList.java.
Roberto sometimes sells one of his buildings. Modify the ApartmentsLinkedList application so that after data entry is complete and the list of Apartment objects is displayed, the application prompts the user for a street address to eliminate. Remove all the Apartment objects at the specified street address, and display the list of Apartments again. Save the file as ApartmentsLinkedList2.java.
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