Introduction to Computer Science I by James Tam | Return to the course web page |
Description of the fields
1. Site name
The name of the site will be stored as a string of characters up to 80 characters in length.
2. Travel cost
This field only tracks only travel costs and excludes other expenses such as accommodations and meals.
3. Vacation type
This field describes the main reason for traveling to this location. There will be five different categories of sites with each one being representing by a single character code: relaxation (r), excitement (e), culture (c), nature (n) or food (f). For this assignment you can assume a particular site will not be categorized in multiple ways.
4. Rating
This field is a numerical value from 1 - 10 that indicates how much that the person wants to go to a particular vacation spot with 10 being the most desirable and 1 being the least desirable.
The information for each site will be separated in the data file by a blank space which is only used to visually separate the information and is not to be read into the array.
Your program reads the information from the input file 'sites.dat' into the array. The contents of that array can be displayed onscreen with write's and writeln statements. Each site will be separated onscreen by a line of stars. To prevent the output from scrolling off the screen your program should 'pause' the display of sites ever so often (say after displaying every 3rd or 4th site) while it waits for a response from the user to tell it to continue (e.g., 'Hit return to continue'). The output must be displayed in a neat and legible format (try running the sample executable for an example). Finally your program must be able to write the site list back to a file whose name will be specified by the user when the program runs. The blank space that separated each site in the input file must be written back to the output file. Similar to previous assignments, your program has menu driven interface. The basic program should display a menu similar to the one shown below:
Site Manager: Menu options
(d)isplay collection (show the collection onscreen).
(l)oad a collection from disk (reads the information for the collection from disk, any existing information in the array will be overwritten by the information that was loaded).
(s)ave the collection to disk (saves the information to a separate output file and not the one that it was originally read from.
(q)uit the program.
You should add additional menu options as you implement the extra features that are listed below.
Completion of each of these extra features will result in the increase of a "one step" to your grade e.g., 'C' to 'C+'. Except for features two, four and six you can complete as many of the features below as you wish in whatever combination that you desire. In the case of those three features you must have completed feature two before you can get credit for feature four or six. Successful completion of all seven features will make you eligible for an A+. (You must also fulfill style requirement as well as the general submission assignment requirements).
Feature one (Alphabetize the site list according to name):
Sort the list into alphabetical order according to the name of the vacation spot.
Feature two (Find additional details about a site):
The user of the program can type in the name of the site (case sensitive) to find additional information about that site . If the site is not in the list, then your program should indicate that the site could not be found under that title. If the site is in the list, then your program will display additional details about that site (all the fields of that site will be displayed onscreen).
Feature three (Present all sites that meet a certain criteria):
This feature allows the user of the program to display onscreen only sites that meet a specific criteria for the 'vacation type' field. The user can type in one of the rating categories and your program will display all the places which are categorized under that type of vacation.
Feature four (Edit site information - requires that you have already completed feature two):
Edit the information for a site in the list. 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 site that they wish to edit by entering the name of the site and the program searches for that site and the user of the program will then be able to re-enter the information for all the fields of that site one field at a time. If site cannot be found in the list then the program will display a suitable error message.
Feature five (Insert a new site):
When this feature is selected by the user, he or she will prompted to enter in information for all the fields of the new site. If the information for the site has not yet been entered and there is room in the array, the new site will then be added to the end of the list. Otherwise a suitable error message will be displayed to the user.
Feature six (Remove a site from the list - requires that you have already completed feature number two):
Again, the user must type in the name of the site in order to indicate which site that he or she wishes to remove from the list so you need have complete the lookup contact feature first (feature two). When the collection is displayed, no information about that site should be displayed - not even blank spaces. You can implement this feature by shifting the array elements that follow the element to be deleted 'up'.
Feature seven (Write an enhanced Save feature)
In order to get credit for this feature, the program will now use only one data file. The program will load the site information from the "sites.dat" file. When the user of the program selects the 'save' option then the program can write the modifications to the "sites.dat" file rather than a separate file. To get credit for this feature your program must be able to reload the updated information from the modified file. This latter requirement means that your program must write the information to disk in the exact same format that it was originally stored. If there any differences from the original data file and the modified version your program will not be able to properly read it back into the array.
D level assignment
The student has invested considerable work in the assignment and the code compiles but it doesn't fulfill any of the above requirements.
D- level assignment
The student has invested considerable work in the assignment but it doesn't compile.