C M S C     2 1 4
C o m p u t e r   S c i e n c e   I I
S p r i n g   2 0 0 3


Project #1

Due Thursday, February 20th, by 11PM

Checklist

Preliminary Material

Project 1 is worth 7% of your grade.

This project deals with a circular doubly linked list and a cipher.

cipher - a cryptographic system in which a symbol (or set of symbols)
represents a single letter of plain text.

  • encipher - substitute a cipher value for a plain text value
  • decipher - substitute a plaintext value for a cipher value
  • keyword - a word or expression that is placed at the beginning of the cipher alphabet
  • offset - a number that indicates which plaintext letter
    is aligned with the first letter in the cipher alphabet.

Further definitions can be found at
http://www.its.bldrdoc.gov/fs-1037/dir-007/_0958.htm

Purpose

This project teaches you about a circular, doubly linked list. It uses a simple cipher, for enciphering and deciphering, to do so. The goals of this project are to:

  1. Understand a doubly linked list.
  2. Review and implement the C++ string class.
  3. Understand the STL vector class and manipulate a vector.
  4. Write and throw exceptions when appropriate.
  5. Write and implement iterators for a circular doubly linked list.
  6. Understand and write unit tests for each class.

Academic Integrity Statement

Please note that *all* programming projects in this course (including this one) are to be done independently or with the assistance of the instructional staff of this course only.

Please review the policies outlined on the class syllabus concerning the use of class computer accounts and concerning the University's Code of Academic Integrity. The instructors of this course will review the programs submitted by students for potential violations of the Code of Academic Integrity and if it is believed that a violation has occurred it will be referred to the Office of Judicial Programs and the Student Honor Council.

Hardcoding is considered a violation of academic integrity

Style Guide

Students are expected to write "clear and legible" code. Please review the following Style Guide which specifies how students in CMSC 214 are expected to lay out their code:

http://www.cs.umd.edu/class/spring2003/cmsc214/Projects/styleguide.txt

FAQ

Answers to "frequently asked questions" will be posted via the main projects page. Prior to asking a question or submitting a project you should check the FAQ to see if any important information has been covered there. In addition to answers to FAQ's any important information pertaining to a project will be posted on it's FAQ.

E-mailing Questions

DON'T email questions. We cannot keep up with the numerous emails about a project. GO SEE A TA or an instructor during office hours. We will not respond to email questions about the project.

Project Overview

For this project you will be required, among other things, to write the code for 5 classes:

class 1: Object
class 2: Node
class 3: Coder
class 4: myExcept
class 5: DllIterator

In the class posting accounts (~bt14001) you can find the header files for 4 of the 5 classes.
The following rules MUST be adhered to:
  • No public functions or (public, protected, or private data members) may be added to the header files.
  • Your output must match our output, an example of which is provided in primary.output
  • You may not change the input - as provided in primary.input
  • Projects submitted after 2 days late will receive a grade of zero.

After copying the header files Object.h, Node.h, DllIterator.h and Coder.h into your account you should create the corresponding Object.cpp, Node.cpp, Coder.cpp, DllIterator.cpp and myExcept.cpp files and write the code that implements the member functions for these classes. Note: you may NOT change the public methods in the header files but may add private methods as needed. You may NOT add private, public or protected data members.

In each header file you will find the class with it's data member(s) and member function(s). There is a comment before/around each member function describing what it should do and you are to implement (aka write the code for) the member function so that it does what the comment states that it should do and nothing more.

myExcept.cpp contains exception classes that are called from Coder.cpp. You must have at least 5 exception classes:

  • popOnEmpty - thrown if processing empty message
  • deleteOnEmpty - thrown if processing empty doubly linked list
  • illegalCharacter - thrown from encipher() if any non-alphabetic character is found
  • 2 or more other exceptions that you determine are necessary



  • a generic exception handler (ie. catch(...) ) should NOT be one of the 2 others you write
    although you may include one as an extra exception handler

Next you should write 4 unit test files to test each of your classes:

  • testObject.cpp
  • testNode.cpp
  • testCoder.cpp
  • testDllIterator.cpp

A unit test file should be a main() for a particular class that calls and tests each public method. It also tests the private methods which are called from public methods. Note that when developing/writing code you should do so in pieces/modules and test each as you create it (keeping backup copies!). So for example, when writing Object, you also write a testObject.cpp that is the main for Object.cpp. It should call all public functions and include appropriate output to test that all Object.cpp code works correctly.

And finally you should write a:

main.cpp

It should contain a main function that will call the reader() method, process the information just read, build the message and keyword, print the cipher and plaintext alphabets, and print the enciphered and deciphered messages.

Your main program should use the classes created earlier to accomplish it's task. You may *not* write any other classes.

Assumptions

You may assume that

  • offset k indicates the k+1 letter of the alphabet (5 = 'f')
  • offset 0 will indicate no offset (a is first letter in plaintext alphabet)
  • offset will be a 1 or 2 digit integer
  • keyword expression may contain blanks and upper/lower case letters
  • message may contain upper/lower case letters, digits, white space, and punctuation
  • input order, on a single line or wrapping around if needed, is:
    • keyword expression
    • offset
    • message
    • EOF marker
  • the input file may be several lines long

Sample I/O

You may assume:

  • There are no blank lines in the input file.
  • Each line terminates with a carriage return.
  • The last line contains an EOF marker.

A primary input file and a primary output file are provided in the class posting accounts (in the appropriate directory). You should review these files. They will be named primary.input and primary.output respectively.

A secondary input file and a secondary output file are also provided for further testing of your code. However, your project will successfully submit if your program passes the primary.input.

On further secondary inputs, you will be given the data for another keyword position and message in the same format as primary.input   Your program should generate the corresponding output similar to primary.output. Additionally, we will test several portions of your code.

When your main program is compiled and run with input redirected so that it gets the contents of the primary input file (primary.input) as input, it should generate output that matches the primary output file. When we test your program we will diff your output (using diff -bwi) with that of the primary output and if it does not match, your program will be considered to not meet the minimum running standards and you will be unable to submit it.

String Help

If you need review on the String Class a few good web sites are:

Hint

MSWord file with an exception example is in the posting account
Class.Handout/except.example.doc

You may choose to code DllIterator.cpp last. Most of your code will work without using this class. However, in order to receive an 'A' on this project, we will test your DllIterator class and it must successfully pass our tests.

How to Submit

Provide a Makefile that creates an executable file named p1 when the command make p1 is run.

Tar up all necessary files, such as source code, including:

  • all .cpp files
  • all .h files
  • your makefile

submit p1.tar 1

Submit will start accepting project 1 submissions on 2/11/03.


See the class syllabus for policies concerning email
Last Modified: Thu Feb 6 20:52:28 EST 2003
left up down right home

Web Accessibility