Problem Description
You are to redesign a property management database program that allows a real estate agent to view, add, search, an
Problem Description
You are to redesign a property management database program that allows a real estate agent to view, add, search, and save property listings. The program, which you are provided with, was originally written using an array of structures. The system will soon be scaled up, and your boss requires you to rewrite the program, making use of classes.
The program does the following:
On start-up, the program prompts the user for the property listings filename. The file contains the address, suburb and price (in dollars) of each property listed by the agent (see sample file provided: properties.txt). The program reads the address, suburb and price of each property from the file into an array of structures.
Once the relevant details have been read, the program displays a menu and prompts the user for their selection – to display properties, search for those <= to a price, add a new property or save the file.
Note: The code provided works well and has been well-formatted, but is intentionally not well-commented. You must add appropriate comments to any of this code you re-use (and any of your own code).
Your Task:
1. Design a Property class. Review the functionality of the original program to determine which parts should be recoded as member functions of the Property class. The class declaration needs to be stored in Property.h, and the member function definitions (implementation) in Property.cpp.
2. Add a date listed to the property information, using a new class, Date. The Property class will contain an instance of the Date class (composition) for the date it was listed.
Use Date.h and Date.cpp for the header and implementation files respectively.
A new data file containing properties with dates is provided (newprops.txt).
3. Write a program PropertyTest.cpp that performs unit tests on the Property class to verify that it works correctly. The file needs to be commented to explain what each unit test is trying to verify.
4. Rewrite the property database program so that it makes use of the Property class.
5. Add functionality to the program (menu item 5, exit becomes 6) so that you can search for all properties listed on or after a date entered by the user.
展开
全部