Java代写:COSC2P05 Niagara Real Estate Company

用Java代写一个房屋租赁公司。

Niagara Real Estate Company

The Niagara Real Estate Company maintains a list of properties for sale.
Properties come in four types:

  1. commercial retail
  2. commercial industrial
  3. residential
  4. farm

All properties, regardless of their type, have the following five attributes:

  1. annual property taxes
  2. list price
  3. lot size (in square feet)
  4. location (the city)
  5. building (the building on the property)

For convenience Niagara Real Estate has divided the Niagara Peninsula into four cities. These are the only valid locations:

  1. stct (St. Catharines)
  2. wlld (Welland)
  3. ngfl (Niagara Falls)
  4. fter (Fort Erie)

All smaller cites and towns are grouped with the nearest large city.

Commercial retail properties have one additional attribute, the retail type. This will be either:

  1. strip mall
  2. large mall
  3. street

Commercial industrial properties have one additional attribute, the industry type. This will be either:

  1. light
  2. medium
  3. heavy

Residential properties have four additional attributes:

  1. sewer (is the property on city sewers y/n)
  2. water (is the property on city water y/n)
  3. garage (does the property have a garage y/n)
  4. pool (does the property have a pool y/n)

The farm property type is treated as a residential property with one additional attribute, the crop type. These are the only valid crop types:

  1. cash
  2. vineyard
  3. fruit
  4. poultry

This is all the information you should need on properties. A description of buildings follows.

Buildings come in three types:

  1. store
  2. factory
  3. house

Obviously, stores go on commercial retail properties, factories go on commercial industrial properties, and houses go on residential and farm properties.

All buildings, regardless of their type, have the following two attributes:

  1. construction material
  2. size (in square feet)

Construction materials come in four types:

  1. brick
  2. wood
  3. siding
  4. other

Store building types have three additional attributes:

  1. shelves (is the shelving included in the sale y/n)
  2. checkout (are the cash registers included in the sale y/n)
  3. safe (is a safe included in the sale y/n)

Factory building types have three additional attributes:

  1. crane (is an overhead crane included y/n)
  2. equipment (is other equipment included y/n)
  3. rail access (is there railway access y/n)

House building types have 4 additional attributes:

  1. number of bedrooms
  2. number of bathrooms
  3. basement (is there a basement y/n)
  4. house type

House types come in the following types:

  1. condo
  2. row
  3. semi
  4. bungalow
  5. split
  6. two story

The problem

The Niagara Real Estate Company has hired you to create a program that will search the list of the properties for sale, based on certain parameters, then display the information on those properties that match the parameters. The search parameters will be the city (stct, wlld, fter, ngfl), the property type (commretail, commindust, residential, farm) and the asking price. For example, the following search should return all of the residential properties in St. Catharines with a list price of $500000 or less.

It is very important that you use exactly the abbreviations listed above for your search parameters. This is to simplify marking. The marker should not have to dig through your code to figure out what string you have used. If your search does not run on the parameters given above your program may be marked as inoperative. Note, to remove any ambiguity you could use radio buttons for the city and the property type, but this is not required.

After you enter the search parameters and click the search button, the program should return a list of properties that match the search criteria and display the first one.

Clicking the next button will display the next property that matches the search criteria:

If there are no more properties to display then clicking the next button should display a message indicating this:

If you search for a different type of property, the result displayer will show different attributes. Here we searched for commindust in wlld costing 5000000 or less. You should not use the same result displayer for all property types. The displayer should match the property type it displays.

Even though a farm is regarded as a type of residential, it should not appear in a search for residential properties. A farm should only appear in a search for a farm property.

Input File Format

The list of properties is stored in a tab delimited text file. This is available with the assignment on Sakai. The following describes the format of the input file. This is a description of one line reading from the left. Note: I have tested this data with many different searches and it seems to work OK. However, I have not tried all possible combinations of location, property type and price, so it is possible there is a bad line of data in the file. If you think you have found bad data, please report this to me.

Programming Instructions and Hints

The purpose of this assignment is to give students practice with inheritance and polymorphism. If your program does not use these tools, then you will get a poor mark. This assignment involves significantly more coding than Assignment 1. I recommend that you get started as soon as possible.

Begin by reading the problem until you understand it. Next, draw up inheritance diagrams. Decide what variables and methods each class will have. Write the code for these classes. Then write the code to read the input file and create the objects. Store them in some data structure. (There is no restriction on using library container classes in this assignment.)

Next, write the code for the search parameter GUI and the result displayer(s) GUI. I suggest you use BasicIO for this. If you have a good understanding of Swing and AWT then feel free to use these libraries, but there are no extra marks for this. Your GUI does not have to be elegant or beautiful. It just has to work.

My code used enums for things like house type, crop type, building material, retail type and so on. This caused considerable extra work, because I had to convert from string to enum when reading the input file then from enum to string when I was displaying the results. I think it would be easier to keep these variables as strings from start to finish.

I am not requiring any error checking on inputs, either in the input file, or in the search parameter GUI. There are simply too many different possible errors to catch and handle.

You must submit an inheritance diagram (tree drawing) with your program. It should show your classes and the variables in each one. This can be done in with a drawing program, or it can be done by hand then scanned. If it is done by hand it must be neat and legible. If the marker can’t read it, he can’t mark it.

Programs must be written in Java. You can use any IDE that is available on the Brock Lab computers. Your program must run and compile on the lab computers or it will not be marked. You should provide a statement specifying the IDE used as well as any additional information needed to run your program.