Assigned | Thursday, November 13thth |
---|---|
Program Due | Sunday, November 23st by 11:59pm |
Weight | 10% |
Updates |
|
To gain experience:
This project is considered an CLOSED project. Please review the open vs. closed project policy before beginning your project.
In pursuit of the "paperless office" (hah), the online storage and
retrieval of documents has become a fundamental requirement of any company.
In this project, you will build a small document storage system (DSS) that
contains documents of various types. You will design the system to
take advantage of the reuse mechanisms that C++ inheritance provides.
For this first of two final projects, you will only be using simple
inheritance and overriding, and will not be allowed
to use any form of polymorphism. So, no virtual functions are
allowed! Any use of the keyword virtual
in your
classes will result in substantial deductions, possibly a 0 (zero).
The goal of the project is to force you to use regular static binding
to understand it's use and limitations.
Starting with our provided drivers and skeletal class definitions, you will build a system that allows users to create and store documents, retrieve documents, and make inquiries about the documents.
In this project, you will design and implement a document storage system (DSS) that will be used by a software consulting firm. This system stores internal company reports and company correspondence, such as memos and emails. All relevant document information will be input by the user. Documents are stored by the DSS in an internal document list.
When a document is initially stored, a unique document identification number is assigned, and the ID and the author who created the document are recorded. The unique ID is assigned to the document starting with 10001. The document number (its ID) is incremented for each subsequent document stored. Your document storage system must be able to store an unlimited number of documents.
In addition to the document ID and author name, which are common to all documents, each individual document type has additional fields which are specific to that type. Your document storage system will initially support three different document types. Company reports include a title. Memos, which are a kind of correspondence, include the name of the person to whom the memo is being sent, a list of people who will receive a copy of the memo (the distribution list), and the subject of the memo. The third type of document, emails, are electronic correspondence that include the email's subject, the name of the person to whom it is being sent, along with his/her email address.
Your document system must provide the following services for the user. We are providing a driver program that lets a user access these services through a command line interface.
Create and store an email message
This service should accept all necessary email information followed by the contents of the email. This service will display the document ID assigned to the email.
Create and store a memo
This service should accept all necessary memo information followed by the body (contents) of the memo. Since there is no limit on the number of names on the distribution list, your program should continue to accept names (one per line) until the user types “END” (without the quotes, in upper-case) at the begining of a separate line. This service will display the document ID assigned to the memo.
Create and store a report
This service accepts all necessary report information followed by the contents of the report. This service will display the document ID assigned to the report.
Display a single document
The user inputs a document ID and all relevant document information is displayed followed by the document body.
List all documents stored in the system
For each document, this service displays the document's ID and author, and any other document-specific information. The body of the documents are NOT displayed. Print out "No documents found." if there are no documents.
Search all documents for a specified word or phrase
The user inputs a word or phrase on a single line. A listing of the IDs of the documents that contain the word/phrase in their text body is displayed. It is NOT necessary to find phrases that are split across lines. Print out "No documents found." if there are no documents.
Empty the document collection
All stored documents are permanently removed from the document system.
Quit the program
Your program exits gracefully.
Document
.
Your Document class should contain all of the data members and functions
that are used in common by the actual specific document type subclasses.
Having duplicated members in child classes that could have been easily
put into a common parent class will be considered poor design, and
penalized.
Each of your document types should be in it's own class. The skeletal
DocumentStore
class that we are providing requires
you to have 3 classes named Email
, Memo
, and
Report
, which are all descendents of Document
.
However, this does not restrict you to making them all direct children--
you are encouraged to actually try out more interesting hierarchy
structures.
However you structure your classes, it must provide the methods expected by the calls already made from the DocumentStore methods, as well as any other calls you add there.
main()
in Proj4.pp, which provides the main control loop.DocumentStore
, instantiated by
main()
, that stores the documents, assigns ID's,
and implements the other services requested by the user.
It needs to maintain the collection of documents.Document
which
implements the base Document class that supports the storage, manipulation,
and output of generic documents. This class will never actually be
instantiated by our driver, but will still provide the implementations
for all of the reusable data members and methods that are common across
the various document subclasses you will be designing.
Document
, which implement the document type-specific
functionality and define the type-specific additional document elements.
vector
class,
and should hold pointers to dynamically allocated document
objects.
delete
to dispose of objects that are no longer needed.
private
. No protected
variables are permitted.main( )
will rely on the DSS to perform the user's
request. Other than constructors, the code in main( )
will not call any methods of any class other than the DSS.m_type
and the
accessor method Document::GetType()
to the Document base
class to do support this.
Each of the actual document classes, Email, Memo, and Report
,
should define their respective constant DOC_TYPE_EMAIL, DOC_TYPE_MEMO,
and DOC_TYPE_REPORT
as unique integers to allow this to work.
Even after a method figures out the type of the document being
referenced, it must then do pointer casting to
allow it to treat the object pointed to as the proper subclass type
in order to work on it as that type.
See the sample code in the implementation of ListActive()
to see how this might be done.
The program takes no command line arguments. It goes into a contiuous loop, prompting for a command, reading it, performing the required operations, then outputting the results. It exits when the user enters "99". The output from a sample run is provided HERE. NOTE: The order of the input prompts when a document is created must match the order found in the sample session so that the grading scripts will work properly.
main()
i. YOU SHOULD NOT MODIFY THIS FILE.cp /afs/umbc.edu/users/p/a/park/pub/cmsc202/fall14/proj4/* .
As always, you will have to create a Makefile.
See the course website for a description of how your project will be graded.
We will be automating much of the grading for this project. It is absolutely essential that you do not modify any of the files that we provided to you; You should not even submit these files. If you do inadvertantly submit your copies of these files, we will be replacing them with our own versions before trying to compile and run your program.
Another requirement is that your executable, as produced by your Makefile, is called Proj4.out; adjust your Makefile accordingly.
Before submitting your project, be sure to compile and test your code on the GL system. See the Project Compilation section of the course Projects page for details on how to compile and execute your project on GL.
Assuming you’ve used the specified file names, submit your project by typing the command
submit cs202 proj4 [all of your various .h and .cpp files] Makefile
See the Project Submission page for detailed instructions. Note that we require you to submit the Makefile, also. We will in fact be using your own Makefile to build your program, so it must work properly.
You may resubmit your files as often as you like, but only the last submittal will be graded and will be used to determine if your project is late. Also note that if you rename or remove certain files, the old versions that you submitted earlier will stay in the submit directory unless you use "submitrm" to clean them out, which you should. At the end, a "submitls" should show exactly those files that are part of your project: no more, no less. For more information, see the Projects page on the course web site.
Remember — if you make any change to your program, no matter how insignificant it may seem, you should recompile and retest your program before submitting it. Even the smallest typo can cause errors and a reduction in your grade.