CMSC 202 Project 4
Document Storage System
Assigned |
Monday, Nov 10, 2008 |
Program Due |
7:00AM, Monday Nov 24, 2008 |
Weight |
9% |
Updates |
Nov 11, 2008
Menu item #5 (List all documents) has been amended. See below |
Objectives
- To gain experience implementing classes in an inheritance hierarchy
- To gain experience with the use of polymorphism
- To gain experience using ArrayList
- To gain experience with exception handling
Project Description
In the information age, the storage and retrieval of documents has become a fundamental
requirement of any company. The ability to query documents about their content is also essential
to the company's smooth operation. In this project you will build a small document storage
system that contains documents of various types. You will also write a menu-driven user interface
that allows users to create and store documents, remove documents, retrieve documents
and make inquires about the documents. We will briefly discuss the design of this
project in class, but not to the extent we discussed project 2 and project 3.
Project Specification
In this project you will design and implement a document storage system which will
be used by the ACME 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.
When a document is stored, the author and date/time created are recorded
and a unique document identification is assigned to the document
starting with document number 10001. The document 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 author, date, and document ID
common to all documents, company reports include a title. Your system must also store memos
which are a kind of correspondence. Memos
include the name of the person to whom the memo is sent, a list of people
who will receive a copy of the memo (the distribution list), and the subject of the memo.
Email must be stored in your document storage system as well.
Emails are electronic correspondence that include the email's subject,
the name of the person to whom it is sent along with his/her email address.
Your document system provides the following services for the user.
Your user menu will display these options in this order and accept an integer menu selection
from the user.
- Create and store an email message
This service should input 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 inputs all necessary memo information followed by the 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) 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 inputs all necessary report information followed by the contents
of the report. This service will display the document ID assigned to the report.
- Display a document.
The user inputs a document ID and all relevant document information
is displayed followed by document text.
- List all documents stored in the document system.
This service displays each document's ID, author, and creation date/time,
and any document specific information in order by document ID.
The contents of the documents are NOT displayed.
- Search all documents for a specified word or phrase.
The user inputs a word or phrase on a single line.
A listing of the document IDs that contain the word/phrase is displayed in document ID order.
It is NOT necessary to find phrases that are split across lines.
- Remove a document.
The user inputs the document ID of the document to be removed.
The system responds with an appropriate message indicating whether or not the document
was removed.
- Quit the program. Your program exits gracefully.
Requirements, Hints, and Tips
- All classes in this project should be in a package named
proj4
.
- Your design should consist of four basic elements which will be briefly discussed in
class.
main( )
which provides the user interface
- A single class (lets call it the DocumentStorageSystem, or DSS for short)
that stores the documents and performs the services requested by the user.
- A hierarchy of document classes
- A set of exception classes
main( )
and all its helper methods must be implemented in Project4.java.
main( )
may only interface with the DSS. It must not use,
reference, or otherwise know about any document class. It should of course handle
appropriate exception classes.
- You should make good use of method overriding, inherited methods, and polymorphism
to show that you understand and can apply these techniques.
- Your code should throw and catch exceptions as appropriate. This includes, but
is not limited to, all method precondition error checking. Note that you do not
need to explicitly check for null parameter references since the JVM will do that for you.
- There is no guarantee that the user will input an integer for the menu selection.
You should therefore use an exception-controlled loop as discussed in class to handle
an inappropriate input type.
- All static and instance variables must be
private
. No protected
variables are permitted.
- You must use
ArrayList
s instead of arrays in this project. You'll want to
do that anyway since they're easier to use.
- Use the
Date
class provided by the Java library for storing and printing
the creation date/time information.
- Note that the body of text for any document may contain blank lines. These blank lines
must be present whenever the text body is displayed.
- Be sure to create only one Scanner object. Declare its reference
as static with class scope so it can be used in
main( )
and all of its helper methods.
- Because the text of the a document is of indeterminant length, your program should continue
to accept text for a document's content until the user types "END" (without the quotes) at the
beginning of a separate line.
Sample Output
A sample user session can be found in this file.
The order of the input prompts when a document is created must match the order
found in the sample session so that grading scripts will work properly.
Project Policy
This project is considered an CLOSED project. Please review the
CLOSED project policy on the course website.
Grading
See the course website for a description of
how your project will be graded.
Project Submission
- Since no files are provided for you, be sure to submit all
.java
files
necessary to compile and run your project.
- Use submitls to verify they are in the remote directory
The order in which the files are listed doesn't matter. However, you must make
sure that all files necessary to compile and run your project are submitted.
You need not submit all files at the same time. 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. For more information,
see the projects page on the course website.
You can check to see what files you have submitted by typing
submitls cs202 Proj4
More complete documentation for submit and related commands can be found
here.
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 compiler errors and a reduction
in your grade.
Avoid unpleasant surprises!