CISS 350 Programming Assignment 6 Police Department



Programming Assignment 6
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 not known. Your program accepts commands to manipulate the database in order to narrow down the list of suspects, in the hope of pinpointing the villain.
The retained criminal information, generated by the previous execution of this program, is input from file “” at the beginning of each execution of the program.
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.
Responses to user commands are to be written to the screen, as described in the Command Processing instructions below.
Echo print 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.
If any new suspects were added (see ADD command), file “” must be rewritten to contain the updated collection of criminal information.
Command Processing
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.
Command, Processing
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.”
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 “” 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.”
Sample Input
(Some of the labels shown in the sample input are not typed in by the user, but are only printed for clarity. For this example, the “” file is empty and all the potential suspects are added by command.)
ADD Name: Quickdraw McGraw Attributes: has a Texas accent has a body guard is computer literate ADD Name: Twingun Morgan Attributes: has a New York accent has red hair smokes cigars ADD Name: Jackda Ripper Attributes: has a body guard bites his fingernails carries a knife is computer literate ADD Name: Annie Getcher Gunn Attributes: has a New York accent has red hair eats Fritos smokes cigars ADD Name: Slowdrawl Raul Attributes: has a Texas accent carries a knife is computer literate eats Fritos ADD Name: Sloan de Uptake Attributes: has a body guard has red hair bites his fingernails is computer literate INQUIRY Code Name: Bang Bang TIP Tip Info: has a New York accent CHECK Quickdraw McGraw TIP Tip Info: has red hair CHECK Annie Getcher Gunn TIP Tip Info: eats Fritos INQUIRY Code Name: Holdup TIP Tip Info: has a Texas accent CHECK Slowdrawl Raul CHECK Sloan de Uptake TIP Tip Info: is computer literate INQUIRY Code Name: Tough Stuff TIP Tip Info: bites his fingernails PRINT CHECK Twingun Morgan TIP Tip Info: has a body guard CHECK Slowdrawl Raul TIP Tip Info: is computer literate QUIT
Data Structures
There is no upper bound to the number of suspects or number of attributes for a given suspect. You cannot use an array-based list to store the suspects or the attributes for a given suspect.
The CHECK operation must be very efficient, because suspects are continually being pulled off the street for questioning and we must decide whether to let them go or ruthlessly interrogate them. Using a simple linked list to store the suspects is not sufficient. You must use a binary search tree. Suspects must be actually deleted from the structure when they are eliminated by TIP information. Because you destroy the list of suspects, as suspects are eliminated by TIP information, each inquiry should work on a copy of the original tree.
TIP is executed much less often than CHECK and hence can be less efficient. It is acceptable if processing a TIP command requires searching the whole data structure of (active) suspects. Thus, a list of attributes can be stored with each suspect. You do not have to link all the suspects with the same attributes together. (This could potentially make for a much faster TIP operation.) You may do this if you want, but it complicates things.
Your design and CRC cards for any classes
A listing of any test driver necessary to check classes
A listing of the test plan for any class as input to the driver
A listing of the source code
A listing of the test plan as input to the program
A listing of the output from the test run
The solution includes a Visual Studio (c++) project
Attachments [Move over files to preview content of those files] (4.32 MB)
Visual Studio C++ Project
Preview CISS350Assignment6.cpp
#xxxxxx xxxxxx “”
#xxxxxx xxx 1000000000
#xxxxxx xx xxxx
xxxxx xxxxxxxxx xxx;
// xxxxx xxxxxx xxxxxx xxxx xx xxxxx xxxxxxxx
typedef struct Element{ int key; string name; list
attributes; // List attributes of suspect Element *leftChild; Element *rightChild; } Node;
ofstream Fin(Input); ofstream Fout(Output);
class BinarySearchTree{
xxxx *xxxx = xxxx;
xxxxxx: xxxx xxxxxxxxx(xxxx
xxxxxxxxxxxx, xxxxxx xxx);
xxxx xxxxxxxxxxxxxx(xxxxxx xxxx);
xxxx xxxxxxxxxxxxxxxx(xxxx *xxxx, xxxxxx xxxx);
xxxx xxxxxxxxx(xxxx *xxxx);
Preview ReadMe.txt
xxxxxxx xxxxxxxxxxx : xxxx350xxxxxxxxxx6 xxxxxxx xxxxxxxx
xxxxxxxxx xxx xxxxxxx xxxx xxxx350xxxxxxxxxx6 xxxxxxxxxxx xxx xxx.
This file contains a summary of what you will find in each of the files that make up your CISS350Assignment6 application.
CISS350Assignment6.vcxproj This is the main project file for VC++ projects generated using an Application Wizard. It contains information about the version of Visual C++ that generated the file, and
xxxxxxxxxxx xxxxx xxx xxxxxxxxx, xxxxxxxxxxxxxx, xxx xxxxxxx xxxxxxxx xxxxxxxx xxxx xxx
xxxxxxxxxxx xxxxxx.
xxxx xx xxx xxxxxxx xxxx xxx xx++ xxxxxxxx xxxxxxxxx xxxxx xx xxxxxxxxxxx xxxxxx.
xx xxxxxxxx xxxxxxxxxxx xxxxx xxx xxxxxxxxxxx xxxxxxx xxx xxxxx xx xxxx xxxxxxx
Preview stdafx.h
// xxxxxx.x : xxxxxxx xxxx xxx xxxxxxxx xxxxxx xxxxxxx xxxxx,
// xx xxxxxxx xxxxxxxx xxxxxxx xxxxx xxxx xxx xxxx xxxxxxxxxx, xxx
// xxx xxxxxxx xxxxxxxxxxxx
#pragma once
#include “targetver.h”
// xxxx: xxxxxxxxx xxxxxxxxxx xxxxxxx xxxx xxxxxxx xxxxxxxx xxxx
Preview targetver.h
#pragma once
// Including SDKDDKVer.h defines the highest available Windows platform.
// If you wish to build your application for a previous Windows platform, include WinSDKVer.h and // set the _WIN32_WINNT macro to the platform you wish to support before including SDKDDKVer.h.
// xxx xxx _xxx32_xxxxx xxxxx xx xxx xxxxxxxx xxx xxxx xx xxxxxxx xxxxxx xxxxxxxxx xxxxxxxxx.x.
Price: $19
Buy Now
Added to cart
Buy More Save More
Buy at least TWO items & save up to 30% OFF your ENTIRE order!
Rack up instant rebates in your shopping cart. Simply add items to your cart, and see the savings add up.
Discounts will automatically be applied on eligible orders.
CISS 350 Programming Assignment 6 Police Department – $19.00
CISS 350 Programming Assignment 7 Compare Two Implementations of a Priority Queue – $19.00
Add to Cart
Added to cart
Save $24
CISS350 Entire Course
Get Entire Course
You May Also Like:
CISS 350 Entire Course
CISS 350 Programming Assignment 1 Checkout System
CISS 350 Programming Assignment 2 Computer Dating Service
CISS 350 Programming Assignment 3 Local Medical Clinic
CISS 350 Programming Assignment 4 Circular Linked List
CISS 350 Programming Assignment 5 Towers of Hanoi
CISS 350 Programming Assignment 7 Compare Two Implementations of a Priority Queue


There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.