UMBC CS 201, Fall 01
UMBC CMSC 201 Fall '01 CSEE | 201 | 201 F'01 | lectures | news | help

CMSC 201
Programming Project Three

Real Estate Database Query System

Out: Monday 10/22/01
Due: Before Midnight, Sunday 11/4/01

The design document for this project, design3.txt ,
is due: Before Midnight, Sunday 10/28/01

Objective

The objective of this assignment is to give you experience with sorting, searching, and otherwise manipulating arrays of structures. You will also continue to practice using good program design and implementation techniques.

Description of the Database Query System

Organizations of all sorts keep their data stored in what is known as a database. For example, UMBC has a database containing information on all of the students that have ever been or are currently enrolled at the University. A database can be manipulated through the use of a software application known as a database management system (DBMS). A DBMS can be used to, among other things, update the database, print information based on specified parameters, and perform computations.

You have been hired by the prestigious real estate firm of Dewey, Cheetum, and Howe to write a database management system to perform some basic queries on their database of houses that they currently have on the market. The database is very basic, containing only the following information for each house:

The system will be able to perform the following functions:


A Sample Run

linux3[1]% a.out Welcome to the Dewey, Cheetum, and Howe Real Estate Database Management System Your program explanation goes here. Query Choices: 1) View all houses by zip code 2) View houses only within a specified zip code 3) View all houses by price 4) Determine the average sales price 5) Quit Enter your choice: 0 Choice must be between 1 and 5, inclusive Query Choices: 1) View all houses by zip code 2) View houses only within a specified zip code 3) View all houses by price 4) Determine the average sales price 5) Quit Enter your choice: 6 Choice must be between 1 and 5, inclusive Query Choices: 1) View all houses by zip code 2) View houses only within a specified zip code 3) View all houses by price 4) Determine the average sales price 5) Quit Enter your choice: 1 Number Street City Zip Price Bedrooms Bathrooms 27 Main_Street Laurel 20707 145900 4 2.5 182 Golden_Court Laurel 20707 135990 4 2.5 10 Main_Street Laurel 20707 110000 3 2.0 3152 Old_Road Laurel 20708 205000 5 5.0 3212 Old_Road Laurel 20708 265000 6 3.0 340 Happy_Way Columbia 21044 200000 5 5.0 320 Happy_Way Columbia 21044 130000 3 1.5 153 Mystic_Way Columbia 21045 125900 4 2.0 157 Mystic_Way Columbia 21045 110000 3 1.5 4346 Elm_Street Baltimore 21250 115000 3 3.0 4112 Elm_Street Baltimore 21250 175000 5 2.5 4217 Elm_Street Baltimore 21250 170000 5 3.5 761 Green_Road Baltimore 21250 105990 3 1.5 4250 Elm_Street Baltimore 21250 155900 4 3.0 710 Green_Road Baltimore 21250 210000 4 4.0 268 Maple_Avenue Frederick 21701 180000 5 4.0 255 Maple_Avenue Frederick 21701 145000 5 2.0 523 Pine_Court Frederick 21701 225990 5 4.5 251 Maple_Avenue Frederick 21701 155900 4 3.5 270 Maple_Avenue Frederick 21701 195000 4 3.0 Query Choices: 1) View all houses by zip code 2) View houses only within a specified zip code 3) View all houses by price 4) Determine the average sales price 5) Quit Enter your choice: 2 Enter the zip code: 21251 Number Street City Zip Price Bedrooms Bathrooms Query Choices: 1) View all houses by zip code 2) View houses only within a specified zip code 3) View all houses by price 4) Determine the average sales price 5) Quit Enter your choice: 2 Enter the zip code: 21250 Number Street City Zip Price Bedrooms Bathrooms 4346 Elm_Street Baltimore 21250 115000 3 3.0 4112 Elm_Street Baltimore 21250 175000 5 2.5 4217 Elm_Street Baltimore 21250 170000 5 3.5 761 Green_Road Baltimore 21250 105990 3 1.5 4250 Elm_Street Baltimore 21250 155900 4 3.0 710 Green_Road Baltimore 21250 210000 4 4.0 Query Choices: 1) View all houses by zip code 2) View houses only within a specified zip code 3) View all houses by price 4) Determine the average sales price 5) Quit Enter your choice: 3 Number Street City Zip Price Bedrooms Bathrooms 3212 Old_Road Laurel 20708 265000 6 3.0 523 Pine_Court Frederick 21701 225990 5 4.5 710 Green_Road Baltimore 21250 210000 4 4.0 3152 Old_Road Laurel 20708 205000 5 5.0 340 Happy_Way Columbia 21044 200000 5 5.0 270 Maple_Avenue Frederick 21701 195000 4 3.0 268 Maple_Avenue Frederick 21701 180000 5 4.0 4112 Elm_Street Baltimore 21250 175000 5 2.5 4217 Elm_Street Baltimore 21250 170000 5 3.5 4250 Elm_Street Baltimore 21250 155900 4 3.0 251 Maple_Avenue Frederick 21701 155900 4 3.5 27 Main_Street Laurel 20707 145900 4 2.5 255 Maple_Avenue Frederick 21701 145000 5 2.0 182 Golden_Court Laurel 20707 135990 4 2.5 320 Happy_Way Columbia 21044 130000 3 1.5 153 Mystic_Way Columbia 21045 125900 4 2.0 4346 Elm_Street Baltimore 21250 115000 3 3.0 10 Main_Street Laurel 20707 110000 3 2.0 157 Mystic_Way Columbia 21045 110000 3 1.5 761 Green_Road Baltimore 21250 105990 3 1.5 Query Choices: 1) View all houses by zip code 2) View houses only within a specified zip code 3) View all houses by price 4) Determine the average sales price 5) Quit Enter your choice: 4 The average home price is $163078 Query Choices: 1) View all houses by zip code 2) View houses only within a specified zip code 3) View all houses by price 4) Determine the average sales price 5) Quit Enter your choice: 5 linux3[2]%


Sample and Test Data Files

The data file that was used for the sample run above can be found in Ms. Mitchell's public directory. To use this file,

Remember that this is a sample file only. The file(s) used to test your program may be (and most likely will be) different. However, you have the following guarantees regarding the file used for grading:

So, make sure to test your program thoroughly using your own test data file(s). Note the following when you create a test file(s):

Reading the Data File

The function needed to read from the input data file into your array is being provided as you have not yet learned how to do file input/output or to work with strings. The prototype for the function is:

int ReadData(HOUSE a[]);

ReadData takes a one-dimensional array of HOUSE structures as an input/output parameter and returns an integer that represents the number of houses in the file. Note that this means that the alias for your structure data type must be HOUSE. The function can be found in Ms. Mitchell's public directory. To copy the file,

Your HOUSE Structure

Your HOUSE structure should contain the following fields in the following order:

Look at the code for function ReadData() to determine what the names of the structure members must be.

Note Regarding Sorting

You must use a selection sort for any sorting that you do in your program.


What to Turn In

You must use separate compilation for this project and should have a file called proj3.c that contains the function main(). You should also have a houses.c and houses.h that contain the functions used by proj3.c and the prototypes for those functions, respectively. Submit as follows: submit cs201 Proj3 proj3.c houses.c houses.h The order in which the files are listed doesn't matter. However, you must make sure that all files necessary to compile your project are listed.