Program 1: Home Finder


Objectives:  This program allows you to gain experience using arrays of structures and file I/O.

Description:  Write a home finder system that reads a listing of available homes from a data file and allows users to search for houses that match their specifications. 

Write a program that will read data from a file (homefinder.txt) that contains information about homes that are currently on the market.  Determine the most appropriate (i.e., most efficient) structure, and store that data in an array of structures.

The file will be comma delimited, and will follow the format below:

MLS#, price, #bedrooms, #baths, square footage, year of construction, lot size, interior feature 1, interior feature 2, interior feature 3, exterior feature 1, exterior feature 2, exterior feature 3

Note that baths can be a single number like 2.5.

Your interface should resemble the interface below, and should allow the user to enter a price range, number of bedrooms, number of bathrooms, and square footage using combo boxes.  Note that the minimum and maximum price are currency values and include the dollar sign and embedded commas.  Use one of the conversion functions to convert the string values to decimal. The program should search the array and list all information about those homes that match or exceed all of the specified parameters.

Include error checking to be sure that the minimum price does not exceed the maximum price.  If any of the fields are omitted then the user should be reminded to select a value.  See the demo for an example. The error checking used can be simple error checking with If/Then/Else statements.

All buttons should work correctly.

Be sure to use GOOD programming practices: no form-level variables, minimal main module, thorough documentation, etc.

Do NOT assume that there are only three external features and three internal features.  There are NOW, but the program must easily modified to accommodate future enhancements such as additional features.
Be sure to review the demo and make your program work as it does. 

Be sure to read the P1 Tips!

 

If you need a refresher on file I/O, review the File Processing notes.  There are other ways of doing File I/O, but the methods in these notes are useful for this application.  For tips on combo boxes, see ComboBox clues.

Data File (I stored it in the bin subdirectory in my program directory)

Sample program from Structures notes.