For this assignment you are to write a Pascal program that allows a person to track a list of personal contacts. For each contact there are five fields:
Given names (first and additional given names)The information for the contacts is stored in the Unix text file, which is called "contacts". For this assignment you are to use the information contained in this file as a starting point for the contact list and as you complete additional features of the program (listed below) you will modify this list. Your program is to read in the information for the contacts from the file and store it an array of Records. From there you program should be able to perform some basic list management features (look under the "Assignment grading" section below.
You can find the information for the list of contacts in Unix under /home/231/assignments/assignment6+7/contacts. Shortly there will be other files available in that directory as well.
At the beginning of your typescript make sure you clearly indicate which grade level that you think you have completed for this assignment
e.g., Assignment for James Tam
B-level assignment
Features completed:
1) All the requirements of a C-level assignment
2) The ability to search for a contact by last name
3) The ability to add a contact
4) The ability to delete a contact
Also, you must annotate in the part of the typescript where in the listing that you are demonstrating that you have completed a particular feature. (e.g., circle the part of the paper typescript where you add a new contact). These annotations can be done by hand (in ink or felt pen) but make sure that it is legible and clearly stands out. It is your responsibility to indicate to your marker what features have been completed and to draw that person's attention to the appropriate place in the assignment submission (don't expect your TA to hunt through an unlabeled 50 page document). If you implement any of the features below make sure you follow the instructions and add, delete or modify the fields exactly as specified. Deviation from those specifications will result in a grade deduction e.g., you add a new record for "John Smith" instead of adding the record specified below.
Your program reads the information from file into the array and you display the contents of that array onscreen (and not to a file) with write's and writeln statements. The output must be neatly formatted in the display and phone numbers must be displayed in the following format: <first three digits>-<last four digits>. Make sure that by formatting the phone number this way that you do not put the dash in with the variable that stores the phone number information. This means that if you complete six you must make sure that you do not write the dash into the output file. The assignment must be properly documented and must follow a good programming standard in order to qualify for a C-grade..
Completion of each of these extra features will result in the increase of a "one step" increase in your grade e.g., C to C+. Except for features three and five (which require you to complete feature two first) you can complete the features in any combination that you wish. Successful completion of all six features will make you eligible for an A.
Sort the array of personal contacts by last name. In the case of contacts with duplicate names you do not need to further sort the contact list according to first names. To demonstrate that this feature is working you must display the list of contacts in sorted form to the screen (via write and writeln statements).
Search for a contact by last name. In the case where there are duplicate cases your program should display all the duplicates. To demonstrate that you have implemented this feature, within your script session conduct a search for contacts with the last name of "Simpson" . The program should pull up all the personal information for this person (given names, last name etc). Then conduct a search under the last name of "Tam".
Edit the information for existing contact. In order to complete the requirements for this feature you must have completed feature two because the user of the program must indicate to the program which contact that they wish to edit by entering the last name. To demonstrate that you have implemented this feature search under the last name "Sisco" . Change the last name to "Sisko" . Your program will also iterate through each field and ask the user to input the new value for the field. Just type in the old information for these fields. (In order to follow good Human-Computer Interaction design principles, your program should only require the user to enter in the information for the field(s) that he or she wishes to change but I won't require this of your programs). Display the contacts of the entire contact list immediately after editing this contact to show now that the new contact has been added to the end. In cases where you need to delete a contact that has the same last name as another contact you need only to perform someone reasonable (e.g., delete the first instance). You do not need to further distinguish contacts by another field such as given names..
Add a new contact. To demonstrate that you have implemented this feature, add to the end of the list (i.e., the first free array element) the following contact:
Given names: LocutusDisplay the contents of the contact list immediately after adding the contact to show that the new contact has been added to the end.
Delete an existing contact. To demonstrate that you have implement this feature delete from the list of contacts the following contact:
Given names: Bruce
Last Name: Lee
Occupation: Martial Artist, Jeet Kune Do Founder
Phone: 2992884
Relationship: Personal
Immediately after deleting this contact display to the contents of the list to show that the contact has been deleted.
Again, since the user must type in the last name of the contact in order to indicate which contact that he or she wishes to delete you need have complete the lookup contact feature first (feature two). In cases where you need to delete a contact that has the same last name as another contact you need only to perform someone reasonable (e.g., delete the first instance). You do not need to further distinguish contacts by another field such as given names.
Write the contacts list to a file. To demonstrate that you have implemented this feature, you must demonstrate that the output file did not exist before running your executable a.out and show the contents of the output file (containing the contact list) after your program has finished running. The output file should be called 'updatedContacts'. All of these steps can completed within your typescript by typing in the following commands at Unix:
%ls -al < Shows the contents of your current working directory and that your output file does not exist>
<Compile program, display source code of the program and execute the features of the program that you completed - any of features one to five above that you completed>
%ls -al <Show the contents of your current working directory and that the output file now does exist>
%cat updatedContacts <show the contents of this file>
You have implement all of the above features. In order to get an A+ for this assignment your program can also distinguish contacts by first name. For example, in the case of the two contacts with the last name of 'Kirk' your program would be able to distinguish the two contacts with this last name not because the given names aren't identical but because the first names are not identical. One is 'James Tiberius Kirk' and the other is 'Samuel Tiberius Kirk'. To demonstrate that your program has this feature implemented do a search for 'Kirk'. At this point the program should indicate that there are two duplicates (showing both contacts) and prompt the user to enter in the first name (and not the first and second name) that they wish to do a sub search under. Enter in 'James' for the first name. Your program should then show all the information related to the contact 'James Tiberius Kirk'.
Understanding and applying the following concepts:
1) Composite types (data structures) - learning how to declare and use records in Pascal.
2) Composite types that contain other composite types - learning how to declare and work with arrays of records in Pascal.
3) List management - this includes common tasks that you might need to complete when dealing with a list of data such as sorting the list, adding new elements to the list, deleting or editing existing elements to the list.
4) Working with persistent information in the form of file input and output - how do you read from and write to a file in Pascal.
1) Start early! This is another tough assignment. There's a lot of new concepts that you have to understand and apply in order to complete the assignment requirements.
2) Take it in small steps. Get the basic program working before you start working on the additional features. Make sure it really works but testing it!
3) Back up your work! Once you get your basic program working make a backup copy (e.g., at Unix type 'cp a6.p a6.basic'. As you complete additional features backup these versions and don't touch the backup and when you start working on more features use a copy.
4) Do attempt this assignment. Although it isn't worth a large percentage of your final grade, writing programs really helps to pound home concepts that you learn in lecture.
5) Addendum to point 4 - while it is important to try this assignment both for the learning and the marks don't fall into the other extreme and spend all your time on these last two assignments worth 11% and no time studying for a final worth 45%.