Write the code for the assignment below and upload the zipped src folder to the learning...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
Write the code for the assignment below and upload the zipped src folder to the learning hub (learn.bcit.ca Activities Assignments Assignment 2) before the dropbox due date. Include your full name at the top of each file, using a Java Javadoc /** @author */ tag (for example: /** @author Jason Harrison */). In Assignment 2 we are building on top of what we created in the first assignment. This time around we will focus on design by incorporating Inheritance, reading data files, and on providing an interface so users can interact with the program at runtime. Changes and additions below are noted in blue font. Class Address Property Instance Variables 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 to thirty characters) Price in USD (double, must be positive) Address (Address, not null) Type (String: must be one of: "residence", "commercial", or "retail") Get methods for all instance variables Methods toString() to display the state of Address objects Property will become a supertype that will hold common fields and behaviours of the subtype Property will no longer support public int getNumberOfBedrooms() nor public boolean hasSwimming Pool() nor the associated fields Get methods for all instance variables Set method for price toString() to display the state of Property objects 1 Class Residence extends Property Commercial extends Property Retail extends Property AddressReader Property Reader Agency Instance Variables Property ID (String: must be one to six characters) numberOfBedrooms(int: must not be less than 1) swimming Pool (boolean: indicates presence of a pool) strata (boolean: indicates if part of a strata) loadingDock (boolean: indicates if it has a loading dock) highway Access (boolean: indicates if easy access to a highway) squareFootage (int: the amount of floor space available) customerParking (boolean: indicates if customer parking is available) Name (String, 1 to 30 characters) Properties (HashMap of properties; key is property id, value is a Property) Subtype of Property Get methods for all fields toString() for displaying the state of Residence types Subtype of Property Get methods for all fields toString() for displaying the state of Commercial types Subtype of Property Get methods for all fields Methods toString() for displaying the state of Retail types public static ArrayList readAddressData(File file) throws FileNotFoundException: reads "address_data.txt" (provided) and adds Address objects to an ArrayList and returns it. public static ArrayList readPropertyData(File file) throws FileNotFoundException: reads "property_data.txt" (provided) and adds Strings (for each line) to an ArrayList and returns it. addProperty(property): adds the (non-null) property to the HashMap removePropery(propertyld): removes the property whose ID matches the parameter, from the HashMap getProperty(propertyld): returns the property whose ID matches the parameter, from the HashMap (or null if there is no match) Class Assignment2 (driver class) Instance Variables Agency: reference to the Agency class Methods get Total PropertyValues(): returns the total amount in USD of all Properties getPropertiesWithPools(): This method needs to be modified to return an ArrayList type properties since only that type will now have swimming pools getPropertiesBetween(minUsd, maxUsd): returns an array of properties whose price falls in the range specified by the parameters...or null if there are none get PropertiesOn(streetName): returns an ArrayList of addresses which are on the specified street...or null if there are none get Properties With Bedrooms(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. NOTE only Residence type have bedrooms so you will have to modify this method to look at Residence types only. getPropertiesOfType(property Type): this existing method needs to be modified to return an ArrayList that hold the subtype specified in the parameter. getPropertiesWithLoading Dock(): returns an ArrayList that holds only Commercial properties that have a loading dock available get PropertiesWithHighwayAccess():returns an ArrayList 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. getProperties With CustomerParking():returns an ArrayList that holds properties where customer parking is available. getProperties WithStrata(): returns ArrayList that hold only the Residences that are in a strata. public void init() throws FileNotFoundException: This method gets the ArrayList and ArrayList form AddressReader and PropertyReader, and uses them to create subtype Objects 3 Class Sample Interface. Instance Variables Methods and adds them to the Agency.HashMap properties public 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(). Welcome to our Property search. Choose one of the following options: 1. 2. 3. 4. 5. General Queries - will present the General Queries menu Residence Queries - will present the Residence Queries menu Commercial Queries - will present the Commercial Queries menu Retail Queries - will present the Retail Queries menu 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.getProperties Between(minUsd, maxUsd) and display results to the console 3. By Street-will further prompt to enter the Street name, call Agency.getProperties On (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.getPropertiesWith Bedrooms(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.getPropertiesWithStrata() and display the results to the console 4. Back - will take you back to the main menu Class Sample Program Run Instance Variables Commercial Queries 1. By Loading Dock - will call Agency.getPropertiesWithLoading Dock() and display results to the console Methods 2. By Highway Access - will call Agency.getProperties With HighwayAccess() 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 WithSquare Footage(int square Footage) 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 See video provided. L O Write the code for the assignment below and upload the zipped src folder to the learning hub (learn.bcit.ca Activities Assignments Assignment 2) before the dropbox due date. Include your full name at the top of each file, using a Java Javadoc /** @author */ tag (for example: /** @author Jason Harrison */). In Assignment 2 we are building on top of what we created in the first assignment. This time around we will focus on design by incorporating Inheritance, reading data files, and on providing an interface so users can interact with the program at runtime. Changes and additions below are noted in blue font. Class Address Property Instance Variables 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 to thirty characters) Price in USD (double, must be positive) Address (Address, not null) Type (String: must be one of: "residence", "commercial", or "retail") Get methods for all instance variables Methods toString() to display the state of Address objects Property will become a supertype that will hold common fields and behaviours of the subtype Property will no longer support public int getNumberOfBedrooms() nor public boolean hasSwimming Pool() nor the associated fields Get methods for all instance variables Set method for price toString() to display the state of Property objects 1 Class Residence extends Property Commercial extends Property Retail extends Property AddressReader Property Reader Agency Instance Variables Property ID (String: must be one to six characters) numberOfBedrooms(int: must not be less than 1) swimming Pool (boolean: indicates presence of a pool) strata (boolean: indicates if part of a strata) loadingDock (boolean: indicates if it has a loading dock) highway Access (boolean: indicates if easy access to a highway) squareFootage (int: the amount of floor space available) customerParking (boolean: indicates if customer parking is available) Name (String, 1 to 30 characters) Properties (HashMap of properties; key is property id, value is a Property) Subtype of Property Get methods for all fields toString() for displaying the state of Residence types Subtype of Property Get methods for all fields toString() for displaying the state of Commercial types Subtype of Property Get methods for all fields Methods toString() for displaying the state of Retail types public static ArrayList readAddressData(File file) throws FileNotFoundException: reads "address_data.txt" (provided) and adds Address objects to an ArrayList and returns it. public static ArrayList readPropertyData(File file) throws FileNotFoundException: reads "property_data.txt" (provided) and adds Strings (for each line) to an ArrayList and returns it. addProperty(property): adds the (non-null) property to the HashMap removePropery(propertyld): removes the property whose ID matches the parameter, from the HashMap getProperty(propertyld): returns the property whose ID matches the parameter, from the HashMap (or null if there is no match) Class Assignment2 (driver class) Instance Variables Agency: reference to the Agency class Methods get Total PropertyValues(): returns the total amount in USD of all Properties getPropertiesWithPools(): This method needs to be modified to return an ArrayList type properties since only that type will now have swimming pools getPropertiesBetween(minUsd, maxUsd): returns an array of properties whose price falls in the range specified by the parameters...or null if there are none get PropertiesOn(streetName): returns an ArrayList of addresses which are on the specified street...or null if there are none get Properties With Bedrooms(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. NOTE only Residence type have bedrooms so you will have to modify this method to look at Residence types only. getPropertiesOfType(property Type): this existing method needs to be modified to return an ArrayList that hold the subtype specified in the parameter. getPropertiesWithLoading Dock(): returns an ArrayList that holds only Commercial properties that have a loading dock available get PropertiesWithHighwayAccess():returns an ArrayList 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. getProperties With CustomerParking():returns an ArrayList that holds properties where customer parking is available. getProperties WithStrata(): returns ArrayList that hold only the Residences that are in a strata. public void init() throws FileNotFoundException: This method gets the ArrayList and ArrayList form AddressReader and PropertyReader, and uses them to create subtype Objects 3 Class Sample Interface. Instance Variables Methods and adds them to the Agency.HashMap properties public 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(). Welcome to our Property search. Choose one of the following options: 1. 2. 3. 4. 5. General Queries - will present the General Queries menu Residence Queries - will present the Residence Queries menu Commercial Queries - will present the Commercial Queries menu Retail Queries - will present the Retail Queries menu 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.getProperties Between(minUsd, maxUsd) and display results to the console 3. By Street-will further prompt to enter the Street name, call Agency.getProperties On (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.getPropertiesWith Bedrooms(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.getPropertiesWithStrata() and display the results to the console 4. Back - will take you back to the main menu Class Sample Program Run Instance Variables Commercial Queries 1. By Loading Dock - will call Agency.getPropertiesWithLoading Dock() and display results to the console Methods 2. By Highway Access - will call Agency.getProperties With HighwayAccess() 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 WithSquare Footage(int square Footage) 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 See video provided. L O
Expert Answer:
Answer rating: 100% (QA)
Based on the instructions and specifications given in the images your task is to implement a Java program with classes that model a real estate agency You have been provided with a class hierarchy and ... View the full answer
Related Book For
Income Tax Fundamentals 2013
ISBN: 9781285586618
31st Edition
Authors: Gerald E. Whittenburg, Martha Altus Buller, Steven L Gill
Posted Date:
Students also viewed these programming questions
-
Random CLUE Speculations Clue is a popular murder-mystery board game. The game is to collect clues to deduce which suspect murdered the games perpetual victim (Mr. Boddy), with which weapon, and in...
-
(a) Sets containing integers can be represented as int list values. Consider two such representations called unordered and ordered. In the former elements can appear in any order; in the latter...
-
Planning is one of the most important management functions in any business. A front office managers first step in planning should involve determine the departments goals. Planning also includes...
-
machine element is made of an alloy with Yield strength of 200 Mpa and fracture strain is 0.08. A machine element is characterized by the normal stress components as shown in the figure. The Answer...
-
In each part, use the method of Example 4 in Section 1.5 to find and check your result by showing that AA-1 = A-1 A = I. (a) 1 1i 0 A=101 -i 1-2i 2
-
Another model for diffusion is called the Bernoulli-Laplace model. Two urns (urn A and urn B) contain a total of 2k molecules. In this case, k of the molecules are of one type (called type I...
-
We have \(100 \mathrm{~kg} / \mathrm{h}\) of a feed that is \(60 \mathrm{wt} \%\) methylcyclohexane (A) and \(40 \mathrm{wt} \% \mathrm{n}\)-heptane (D) and \(50 \mathrm{~kg} / \mathrm{h}\) of a feed...
-
Analyzing the Effects of Transactions Using T-Accounts and Interpreting the Total Asset Turnover Ratio as a Financial Analyst Massa Company, which has been operating for three years, provides...
-
An executory contract is a contract in which all parties have completely carried out their parts of the contract.
-
Comprehensive Problem 1 - Part 1: Taxpayer information, Form 1040, Schedules 1, 2, 3 and 4, Schedule A, and Schedule B. Noah and Joan Arc's Tax Return Note: This problem is divided into three parts....
-
Aluminum fluoride, AlF3, has a Ksp value of 1.1x10?3.Aluminum nitrate and calcium fluoride are added to water to get asolution with 0.15 M Al(NO3)3 and 0.15 M CaF2. Whatcan be said about this...
-
One difference in the assumptions of the Ricardian versus the specific-factors model is the following: The marginal productivity of labor is constant in the Ricardian model and declining as...
-
sin x Q2: Find the Derivative of y=Xx Q3: Find second order derivative of y=x+2x+3x+ x
-
a)Write a C# program to create List instead of array for the cars array below and add all the car items to the list. (3 marks) cars={"Volvo","BMW","Ford","Mazda"}; b)Write HTML code for following web...
-
Assuming a competitive market for N95 masks, explain the effect on equilibrium price and quantity of the following scenarios: a) a change in technology that decreases the cost of manufacturing the...
-
What role does metacognition play in the enhancement of organizational skills, particularly in the context of project management and strategic planning?
-
The pseudocode below takes an integer as input and prints the factorial of that number. Write the equivalent program, including taking the integer from the command line, in Java. Call the program...
-
Test your confidence in the following Project Decisions: SI. # Question 01 02 03 04 05 06 07 08 09 10 How many years did it take to construct the largest Egyptian Pyramid- Pyramid of Cheops? When was...
-
Scott Butterfield is self-employed as a CPA. He uses the cash method of accounting, and his Social Security number is 644-47-7833. His principal business code is 541211. Scott's CPA practice is...
-
Bea Jones (age 32) moved from Texas to Florida in December 2011. She lives at 654 Ocean Way, Gulfport, FL 33707. Bea's Social Security number is 466-78-7359 and she is single. Her earnings and income...
-
Frank Willingham has the following transactions during the year: Sale of office equipment on March 15 that cost $20,000 when purchased on July 1, 2010. Frank has claimed $5,000 in depreciation and...
-
Which infrastructure replacement option involves purchasing or leasing a phys ical site, prewiring it for telephone and Internet access, and contracting with one or more vendors to have computers and...
-
Which of the following is an example of an output control? a. size check c. cross-footing balance check b. encryption d. forms design
-
Which backup method is the fastest? a. full daily backup c. differential daily backup b. incremental daily backup d. complete daily backup
Study smarter with the SolutionInn App