Question
Looking for some help on the following project. Create the following classes along with the specified instance data and methods. Make sure you use /**
Looking for some help on the following project.
Create the following classes along with the specified instance data and methods. Make sure you use /** Javadoc comments */ to comment all public classes, constructors, and methods (with the @author, @version, @return, and @param tags as appropriate). Make sure the constructor validates data as specified. All constructors and mutators must throw an IllegalArgumentException when parameters do not match the expected format (listed below). The main method must try/catch/finally every object creation. Make all data (including parameters) final if it is not expected/desired to change. Avoid magic numbers; e.g. use public static final double PI = 3.14 instead of simply using 3.14).
CLASS | INSTANCE VARIABLES | METHODS | |
Address | Unit number (String: must be one to four characters) Street number (int must be 0 to 999999) Street name (String: must be one to twenty characters) Postal code (String: must be either length 5 or length 6) City (String: must be one thirty characters) | Get methods for all instance variables toString() to display the state of Address objects | |
Property |
| Property will be a supertype that will hold common fields and behaviors of the subtype. Get methods for all instance variables Set method for price toString() to display the state of Property objects | |
Residence (extends Property) | numberOfBedrooms (int: must not be less than 1) swimmingPool (boolean: indicates presence of a pool) strata (boolean: indicates if part of a strata) | Subtype of Property Get methods for all fields toString() for displaying the state of Residence types | |
Commercial (extends Property) | loadingDock (boolean: indicates if it has a loading dock) highwayAccess (boolean: indicates if easy access to a highway) | Subtype of Property Get methods for all fields toString() for displaying the state of Commercial types | |
Retail (extends Property) | squareFootage (int: the amount of floor space available) customerParking (boolean: indicates if customer parking is available. | Subtype of Property Get methods for all fields toString() for displaying the state of Retail types | |
AddressReader |
| ||
PropertyReader | public static ArrayList | ||
Agency |
| addProperty(property): adds the (non-null) property to the HashMap removePropery(propertyId): removes the property whose ID matches the parameter, from the HashMap getProperty(propertyId): returns the property whose ID matches the parameter, from the HashMap (or null if there is no match) getTotalPropertyValues(): returns the total amount in USD of all Properties getPropertiesWithPools(): return an ArrayList getPropertiesBetween(minUsd, maxUsd): returns an array of properties whose price falls in the range specified by the parametersor null if there are none getPropertiesOn(streetName): returns an ArrayList of addresses which are on the specified streetor null if there are none getPropertiesWithBedrooms(minBedrooms, maxBedrooms): returns a HashMap of Residences (key is property id, value is the Residence) whose number of bedrooms falls in ther ange specified by the parametersor null if there are none getPropertiesOfType(propertyType): returns an ArrayList Type: COMMERCIAL 1) Property 9999: unit #9 at 99 Gretzky Way T6V7H3 in Toronto (1 bedroom): $99999. 2) Property 678T: 1515 Main Street V8Y7R3 in West Vancouver (2 bedrooms plus pool): $4000000. 3) Property A1212: unit #7h at 1500 Railway Avenue V9V5V4 in Richmond (4 bedrooms): $840000. Note that the sample output above is exactly what should be returned for the data shown below; it must create similar sentence structures for any property of any type. Notice the capitalization of various parts of the string (see above) versus how it was stored (see below). If there are NO properties of the specified type the output must be as follows: Type: RETAIL getPropertiesWithHighwayAccess():returns an ArrayList getPropertiesWithSquareFootage(int squareFootage): returns an ArrayList getPropertiesWithCustomerParking():returns an ArrayList getPropertiesWithStrata(): returns ArrayList | |
Assignment2 (main class) | Agency: reference to the Agency class | public void init() throws FileNotFoundException: This method gets the ArrayList and ArrayListpublic void doSearches(): This method provides the primary user interface through command prompts that will allow the user to choose which search operations to perform. See the Sample Interface below. Each search will display results to the console. public static void main(String[] args) throws FileNotFoundException: Will create an instance of Assignment2 and use that to call init() and then doSearches(). | |
Sample Interface | Welcome to our Property search. Choose one of the following options: 1. General Queries will present the General Queries menu 2. Residence Queries will present the Residence Queries menu 3. Commercial Queries will present the Commercial Queries menu 4. Retail Queries will present the Retail Queries menu 5. Exit will exit the program ------------------------------------------------------------------ General Queries 1. By Property ID will further prompt to ender Property ID, then call Agency.getProperty(propertyId) and display the result to the console 2. By Price will further prompt to enter both min and max ranges, call Agency.getPropertiesBetween(minUsd, maxUsd) and display results to the console 3. By Street will further prompt to enter the Street name, call Agency.getPropertiesOn(streetName) and display results to the console 4. By Type will further prompt to enter the property type (residence, commercial, retail), call Agency.getPropertiesOfType(propertyType) and display results to the console 5. Back will take you back to the main menu ------------------------------------------------------------------ Residence Queries 1. By Bedroom will further prompt to enter the min and max ranges, call Agency.getPropertiesWithBedrooms(minBedrooms, maxBedrooms) 2. By Pool will call Agency.getPropertiesWithPools() and display only the residences that have swimming pools 3. By Strata will call Agency.getPropertiesWithStrata() and display the results to the console 4. Back will take you back to the main menu ------------------------------------------------------------------ Commercial Queries 1. By Loading Dock will call Agency.getPropertiesWithLoadingDock() and display results to the console 2. By Highway Access will call Agency.getPropertiesWithHighwayAccess() and display the results to the console 3. Back will take you back to the main menu ------------------------------------------------------------------ Retail Queries 1. By Square Footage will further prompt for min square footage value, call Agency.getProperties WithSquareFootage(int squareFootage) and display results to the console 2. By Customer Parking will call Agency.getPropertiesWithCustomerParking() and display only Retail properties where customer parking is available 3. Back will take you back to the main menu |
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