The objective of this programming assignment bring together several key programming concepts (file input/output, arrays, and classes) to build an interactive program for looking up information about famous computer scientists. To initialize the application, students must read an ascii file called people.txt. Each line of the file contains the following pieces of information:
If you look at the people.txt file, you will notice that the first and last names are single strings, and that the birth and death years are integers. A death year of -1 is used to indicate that the person is still alive. The contribution field is a string with a variable number of words. Therefore, you will have to use getline to read to the end of a line in order to read in the contribution.
Your task is to read/store the information above into an object oriented data structure. Your program should then allow the user to search this data structure for computer scientists three ways: (1) using their first name, (2) using their last name, or (3) using a range of birth years. Your program should print out all records that match the search criteria.
Students are required to define two classes "Person" and "Table" to contain the information in the "people.txt" file. Each line of the input file corresponds to a Person to be inserted into into the Table. Therefore, the data contained in each line should be used to set a Person object's data members. The Table class should contain an array of Person objects. Students must define these two classes and specify the constructor destructor functions, the public methods and private variables.
The Person class must contain the following methods.
The Table class must contain the following methods.
The methods above should be used to implement the interactive search program. Students may want to refer to previous labs for examples of file input/output and classes.
To simplify the implementation process, you will be given the class definitions for the Person class in a file "person.h" and the class definitions for the Table class in "table.h". Your task will be to complete the implementations of these classes in two files "person.cpp" and "table.cpp". Then you should implement the user interface for your program in "main.cpp". Remember to use #include at the top of your *.cpp files to include your class definitions. Also, to compile your program you can use:
Since you are starting with a the class definition, your first task is to implement each of the methods. It might be a good idea to start with "skeleton methods" to get something to compile, and then add the desired code to each method incrementally writing comments, adding code, compiling, debugging, a little bit at a time. Once you have the methods implemented, it should be fairly simple to create a main program that calls these methods to complete your project.
Remember to use good programming style when creating your program -- good names for variables and constants, proper indenting for loops and conditionals, clear comments, etc. Also, be sure to save backup copies of your program somewhere safe. Otherwise, you may end up retyping your whole program if something goes wrong.
Test your program to check that it operates correctly for all of the requirements listed above. Also check for the error handling capabilities of the code. Try your program with several input values, and save your testing output in text files for inclusion in your project report.
When you have completed your C++ program, write a short report using the project report template describing what the objectives were, what you did, and the status of the program. Does it work properly for all test cases? Are there any known problems? Save this report to be submitted electronically.
In this class, we will be using electronic project submission to make sure that all students hand their programming projects and labs on time, and to perform automatic analysis of all programs that are submitted.
Rename your program and documentation files 123456789.hw7.cpp and 123456789.hw7.docx using your UAID number in place of 123456789, and go the Blackboard site for this class and submit these two files.
The dates on your electronic submission will be used to verify that you met the due date above. All late projects will receive reduced credit:
This course will be using highly effective program comparison software to calculate the similarity of all programs to each other, and to homework assignments from previous semesters. Please do not be tempted to plagiarize from another student.
Violations of the policies above will be reported to the Provost's office and may result in a ZERO on the programming project, an F in the class, or suspension from the university, depending on the severity of the violation and any history of prior violations.