Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Address Create the following classes along with the specified instance data and methods. Make sure you use /** Javadoc comments */ to comment all public

image text in transcribedimage text in transcribedimage text in transcribedimage text in transcribedimage text in transcribed

Address 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 Unit number (String: must Get methods for all instance variables be one to four characters) toString() to display the state of Address objects Street number(int must be O to 999999) Street name (String: must be one to twenty characters) Postal code (String: must be either length 5 or length 6) Property City (String: must be one to thirty characters) Price in USD (double, must Property will be a supertype that will hold common fields and behaviors of the subtype. be positive) Get methods for all instance variables Address (Address, not null) Set method for price Type (String: must be one of: "residence", toString() to display the state of Property objects "commercial", or "retail") Property ID (String: must be one to six characters) 1 Residence numberOfBedrooms (int: Subtype of Property (extends must not be less than 1) Property) Get methods for all fields swimmingpool (boolean: indicates presence of a toString() for displaying the state of Residence types pool) strata (boolean: indicates if part of a strata) Commercial loadingDock (boolean: Subtype of Property (extends indicates if it has a loading Property) dock) Get methods for all fields highwayAccess (boolean: toString() for displaying the state of Commercial types indicates if easy access to a highway) Retail squareFootage (int: the Subtype of Property (extends amount of floor space Property) available) Get methods for all fields customerParking (boolean: toString() for displaying the state of Retail types indicates if customer parking is available. AddressReader public static ArrayList
readAddressData(File file) throws FileNotFoundException: reads "address_data.txt" (provided) and adds Address objects to an ArrayList
and returns it. Property Reader public static ArrayListreadPropertyData(File file) throws FileNotFoundException: reads "property_data.txt" (provided) and adds Strings (for each line) to an ArrayList and returns it. Agency Name (String, 1 to 30 addProperty(property): adds the (non-null) property to the HashMap characters) removePropery(propertyld): removes the property whose ID matches the parameter, from Properties (HashMap of the HashMap properties; key is property id, value is a Property) 2 getProperty(propertyld); 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 getProperties WithPools(): return an ArrayList type properties... or null if there are none getPropertiesBetween(minusd, maxUsd): returns an array of properties whose price falls in the range specified by the parameters...or null if there are none getPropertiesOn(streetName); returns an ArrayList of addresses which are on the specified street...or null if there are none getProperties WithBedrooms(minBedrooms, maxBedrooms): returns a HashMap of Residences (key is property id, value is the Residence) whose number of bedrooms falls in the range specified by the parameters...or null if there are none getPropertiesOfType(property Type); returns an ArrayList that holds the subtype specified in the parameter. Parameter needs to be case insensitive (e.g. commercial) and results displayed in the following format: 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: 3 Type: RETAIL getPropertiesWithLoading Dock(); returns an ArrayListthat holds only Commercial properties that have a loading dock available getPropertiesWithHighwayAccess();returns an ArrayListCommercial>that holds only Commercial properties that have highway access getProperties WithSquareFootage(int squareFootage): returns an ArrayList that holds properties where square footage is at least the parameter value. getPropertiesWith CustomerParking();returns an ArrayListthat holds properties where customer parking is available. getPropertiesWith Strata(): returns ArrayList and ArrayListform AddressReader and PropertyReader, and uses them to create subtype Objects and adds them to the Agency.HashMap properties public void do Searches(): 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 Assignment 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(propertyld) and display the result to the console 2. By Price - will further prompt to enter both min and max ranges, call Agency.getPropertiesBetween(minusd, max Usd) 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.getProperties OfType(property Type) 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.getProperties WithBedrooms(minBedrooms, maxBedrooms) 2. By Pool - will call Agency.getProperties With Pools() and display only the residences that have swimming pools 3. By Strata - will call Agency.getProperties With Strata() 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.getPropertiesWithLoadingDockl) 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 With Square Footage(int squareFootage) and display results to the console 2. By Customer Parking - will call Agency.getProperties With CustomerParking() and display only Retail properties where customer parking is available 3. Back - will take you back to the main menu 5 Address 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 Unit number (String: must Get methods for all instance variables be one to four characters) toString() to display the state of Address objects Street number(int must be O to 999999) Street name (String: must be one to twenty characters) Postal code (String: must be either length 5 or length 6) Property City (String: must be one to thirty characters) Price in USD (double, must Property will be a supertype that will hold common fields and behaviors of the subtype. be positive) Get methods for all instance variables Address (Address, not null) Set method for price Type (String: must be one of: "residence", toString() to display the state of Property objects "commercial", or "retail") Property ID (String: must be one to six characters) 1 Residence numberOfBedrooms (int: Subtype of Property (extends must not be less than 1) Property) Get methods for all fields swimmingpool (boolean: indicates presence of a toString() for displaying the state of Residence types pool) strata (boolean: indicates if part of a strata) Commercial loadingDock (boolean: Subtype of Property (extends indicates if it has a loading Property) dock) Get methods for all fields highwayAccess (boolean: toString() for displaying the state of Commercial types indicates if easy access to a highway) Retail squareFootage (int: the Subtype of Property (extends amount of floor space Property) available) Get methods for all fields customerParking (boolean: toString() for displaying the state of Retail types indicates if customer parking is available. AddressReader public static ArrayList
readAddressData(File file) throws FileNotFoundException: reads "address_data.txt" (provided) and adds Address objects to an ArrayList
and returns it. Property Reader public static ArrayListreadPropertyData(File file) throws FileNotFoundException: reads "property_data.txt" (provided) and adds Strings (for each line) to an ArrayList and returns it. Agency Name (String, 1 to 30 addProperty(property): adds the (non-null) property to the HashMap characters) removePropery(propertyld): removes the property whose ID matches the parameter, from Properties (HashMap of the HashMap properties; key is property id, value is a Property) 2 getProperty(propertyld); 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 getProperties WithPools(): return an ArrayList type properties... or null if there are none getPropertiesBetween(minusd, maxUsd): returns an array of properties whose price falls in the range specified by the parameters...or null if there are none getPropertiesOn(streetName); returns an ArrayList of addresses which are on the specified street...or null if there are none getProperties WithBedrooms(minBedrooms, maxBedrooms): returns a HashMap of Residences (key is property id, value is the Residence) whose number of bedrooms falls in the range specified by the parameters...or null if there are none getPropertiesOfType(property Type); returns an ArrayList that holds the subtype specified in the parameter. Parameter needs to be case insensitive (e.g. commercial) and results displayed in the following format: 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: 3 Type: RETAIL getPropertiesWithLoading Dock(); returns an ArrayListthat holds only Commercial properties that have a loading dock available getPropertiesWithHighwayAccess();returns an ArrayListCommercial>that holds only Commercial properties that have highway access getProperties WithSquareFootage(int squareFootage): returns an ArrayList that holds properties where square footage is at least the parameter value. getPropertiesWith CustomerParking();returns an ArrayListthat holds properties where customer parking is available. getPropertiesWith Strata(): returns ArrayList and ArrayListform AddressReader and PropertyReader, and uses them to create subtype Objects and adds them to the Agency.HashMap properties public void do Searches(): 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 Assignment 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(propertyld) and display the result to the console 2. By Price - will further prompt to enter both min and max ranges, call Agency.getPropertiesBetween(minusd, max Usd) 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.getProperties OfType(property Type) 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.getProperties WithBedrooms(minBedrooms, maxBedrooms) 2. By Pool - will call Agency.getProperties With Pools() and display only the residences that have swimming pools 3. By Strata - will call Agency.getProperties With Strata() 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.getPropertiesWithLoadingDockl) 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 With Square Footage(int squareFootage) and display results to the console 2. By Customer Parking - will call Agency.getProperties With CustomerParking() and display only Retail properties where customer parking is available 3. Back - will take you back to the main menu 5

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

Mastering Apache Cassandra 3 X An Expert Guide To Improving Database Scalability And Availability Without Compromising Performance

Authors: Aaron Ploetz ,Tejaswi Malepati ,Nishant Neeraj

3rd Edition

1789131499, 978-1789131499

More Books

Students also viewed these Databases questions

Question

Which of the following is not a data warehouse

Answered: 1 week ago

Question

Describe how parent-infant attachment bonds form.

Answered: 1 week ago

Question

Discuss the importance of workforce planning.

Answered: 1 week ago

Question

Differentiate between a mission statement and a vision statement.

Answered: 1 week ago