Your assignment is to write a program for a police department that has collected a database of information on various suspects for a given crime. (Luckily for you, the department is only investigating one crime at a time.) Each suspect has a set of attributes, such as shifty eyes, a limp, or a parrot on his shoulder. The maximum number of such attributes for any suspect is 6. Your program accepts commands to manipulate the database in order to narrow down the list of suspects, in the hope of pinpointing the villain.
1. The retained criminal information, generated by the previous execution of this program, is input from file "Criminal.mf" at the beginning of each inquiry.
2. The user inputs commands from the keyboard, in the format shown below. Names and attributes are strings of no more than 20 characters. The program should not be case sensitive (e.g., 'JOE' and 'Joe' are the same name). To simplify the processing, you can assume that names are unique; that is, no two criminals use the same professional handle. The commands are discussed in detail in the Command Processing instructions below.
1. Responses to user commands are to be written to the screen, as described in the Command Processing instructions below.
2. Echoprint each command and show the results of any PRINT commands in a file called "Criminal.trn". You may determine the format of the information in this file; it should be labeled and formatted clearly. A hard copy of this file is turned in with your program for grading.
3. If any new suspects were added (see ADD command), file "Criminal.mf" must be rewritten to contain the updated collection of criminal information.
New suspects can be added to the collection of criminal information using the ADD command. An inquiry consists of a set of commands with respect to a single crime, at the end of which the crime is assumed to be solved. An inquiry must be completed within the execution of the program; it cannot be "saved" to finish on a subsequent execution. After an inquiry is complete, a new inquiry (the investigation of another crime) can begin. Each new inquiry starts over with the entire collection of suspects. ADD - Add a suspect to the Suspects data structure. Prompt the user for the suspect's name and a list of attributes. ADD commands can be issued only before an inquiry begins.
INQUIRY - Prompt user for code name of this inquiry. Once the inquiry has begun, do not allow the user to issue the ADD command until this inquiry is complete.
TIP - Prompt user for the tip information (a particular attribute). Process the tip, reducing the set of current suspects by deleting suspects who do not match the attribute mentioned in the tip. If there is only one suspect left in the set of active suspects, print out a message indicating that the crime is solved. Be sure to include the suspect's name and inquiry code name. This terminates the current inquiry. (The current inquiry can also be terminated if all suspects have been eliminated. State “all suspects have been eliminate” for the current inquiry.)
CHECK - Prompt the user for a suspect's name. Check the set of active suspects to see if this name is there; print out an appropriate response.
PRINT - Print the set of active suspects (those who have not yet been eliminated).
QUIT - If any new suspects have been added during this execution of the program, rewrite the "Criminal.mf" file. Be careful about how you go about saving the records; the traversal order affects the shape of the tree that is built on the next execution of the program. Terminate the program.
Here is A++ solution for this question.
Using Visual Studio (C++ project) to programming.
If you have more question, please contact me via email firstname.lastname@example.org
I will help you any time
Thank you so much