Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Create an Eclipse project named Manageland. Create a package named ultra.instinct.Manageland. Place the Manageland class described below in this package. Create a package named ultra.instinct.land.

image text in transcribedCreate an Eclipse project named Manageland. Create a package named ultra.instinct.Manageland. Place the Manageland class described below in this package. Create a package named ultra.instinct.land. Put all the remaining classes described below in this package. Make the Land, Casa, and Squarehouse classes serializable. Make the Land class comparable. Create the LandZipComparator class. Implement the Comparator interface. Override the compare method using the zip code for the comparison. Implement the IllegalLandArgumentException class. Make this a checked exception. Implement the constructors shown in the UML class diagram. The following requirements are for the Land class. Make the Land class abstract. Implement the class variables shown in the UML class diagram. Implement the constructor shown in the UML class diagram. Call the set methods to update the class variables. Implement the get and set methods shown in the UML class diagram. The set methods must have the following edits: numeric parameter values must be greater than zero; String parameters values cannot be null or have a length less than one. Throw the IllegalLandArgumentException exception if a parameter is invalid. Instantiate the IllegalLandArgumentException with a descriptive error message. Override the compareTo method. Use the balance for the comparison. Override the toString method. The following requirements are for the Casa class. Implement the class variable(s) shown in the UML class diagram. Implement the constructor shown in the UML class diagram. Call the set methods to update the class variables. Implement the get and set methods shown in the UML class diagram. The set methods must have the following edits: numeric parameter values must be greater than zero; String parameters values cannot be null or have a length less than one. Throw the IllegalLandArgumentException exception if a parameter is invalid. Instantiate the IllegalLandArgumentException with a descriptive error message. Override the toString method. Call the superclass toString method and then add the values for the Home class. The following requirements are for the Squarehouse class. Implement the class variable(s) shown in the UML class diagram. Implement the constructor shown in the UML class diagram. Call the set methods to update the class variables. Implement the get and set methods shown in the UML class diagram. The set methods must have the following edits: numeric parameter values must be greater than zero; String parameters values cannot be null or have a length less than one. Throw the IllegalLandArgumentException exception if a parameter is invalid. Instantiate the IllegalLandArgumentException with a descriptive error message. Override the toString method. Call the superclass toString method and then add the values for the Squarehouse class. The following requirements are for the IllegalLandArgumentException class. Implement the constructors shown in the UML class diagram. The following requirements are for the LandZipComparator class. Implement the Comparator interface for Land objects. Override the compare method. Use the zip code field to compare Land objects. The following requirements are for the Manageland application class. This class will have the main method. Do NOT throw any exceptions from the main method of this class. Create an ArrayList to store Land objects. Display a menu that has choices for: 1 - Add casa; 2 - Add squarehouse; 3 - Delete land; 4 - List all land by value; 5 - List all land by zip code; 6 - Exit. Display an error message and repeat the menu if some other value is entered. This will require you to catch the appropriate exception if letters or just the enter key instead of numbers are entered. The application must continue to display the menu and process these options until the user enters a 7. When the user chooses menu option 1, prompt for the user to enter the appropriate data for a Casa object. Read the data using a Scanner and System.in. Implement the following edits: numeric input values must be greater than zero; String input values cannot be null or have a length less than one. If any one piece of input data is invalid, prompt the user to re-enter that data. Continue to prompt the user until a valid value is entered. If all the data is valid, create a Casa object and store it in the ArrayList. Catch the IllegalLandArgumentException when calling the constructor. NOTE: Any String input value must allow spaces. For example, the address must allow entry of data like "100 Main Street". When the user chooses menu option 2, prompt for the user to enter the appropriate data for an Squarehouse object. Read the data using a Scanner and System.in. Implement the following edits: numeric input values must be greater than zero; String input values cannot be null or have a length less than one. If any one piece of input data is invalid, prompt the user to re-enter that data. Continue to prompt the user until a valid value is entered. If all the data is valid, create an Squarehouse object and store it in the ArrayList. Catch the IllegalLandArgumentException when calling the constructor. NOTE: Any String input value must allow spaces. For example, the address must allow entry of data like "100 Main Street". When the user chooses menu option 3, prompt the user to enter a land ID. Search the ArrayList to find the object with this ID. Remove this object from the ArrayList if found. Display an error message if not found or if the ArrayList is empty. Be sure to test deleting the last land from the array list. When the user chooses menu option 4, list all the objects contained in the ArrayList by calling their toString method. The objects must be listed in order of their value with the lowest value land listed first. Use the comparable for this. When the user chooses menu option 5, list all the objects contained in the ArrayList by calling their toString method. The objects must be listed in order of their zip code with the lowest zip code land listed first. Use the comparator for this. When the user chooses menu option 6, check to see if the ArrayList has any Land objects in it. If it does, write each object to a binary file (land.dat). Make sure you write each object to the file NOT the ArrayList. Then display the message "Thank you for using the Land Manager" and end the application. The data must be written to a relative file location using the file name land.dat. Make this file name a class constant and use the constant in your code wherever necessary. Use try with resources when writing the file. Make sure you test your application with and without a land.dat file present. When the application first starts check to see if the land.dat file exists. If it does, read each Land object and store it in the ArrayList. If the file doesn't exist just continue with an empty ArrayList. Use try with resources when reading the file.image text in transcribedimage text in transcribed

> Comparator land > Comparable abstract>> land ZipComparator Casa quareHouse Illegal land ArgumentException > Serializable > Comparator land > Comparable abstract>> land ZipComparator Casa quareHouse Illegal land ArgumentException > Serializable

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sql++ For Sql Users A Tutorial

Authors: Don Chamberlin

1st Edition

0692184503, 978-0692184509

More Books

Students also viewed these Databases questions