C M S C     2 1 4
C o m p u t e r   S c i e n c e   II
F a l l   2 0 0 4


Project #3

Due Thursday, November 4th, by 11PM

Preliminary Material

Project 3 is worth 8% 10% (CORRECTION - 10%) of your grade.

NOTE: failure to follow ANY of the general guidelines outlined in this and prior project descriptions in this course may result in the loss of points on this project.

As with all projects it is extremely important to begin early. There are generally a number of details contained in a project description such as this one. Please note that failure to follow the details outlined in the project description could result in a substantial loss of points so it is very important to pay close attention to the project description.

Email and Office Hours

Note that email regarding project questions will go unanswered and the means for obtaining assistance on a project is through office hours. See the course syllabus for additional information regarding these policies. In particular the course syllabus states that email is for "emergency purposes only" and if you do send email you must include the appropriate information (including your full name, login ID and class section number).

Purpose

To modify project 2 so that a Binary Search Tree (BST) template is used.

Note that this project may be substantially more challenging than project 2 and thus you should not delay in starting to work on it. In particular in project 2 you really did NOT have to write any "new" code (besides the AMember class which was very short "easy" code). In project 3 you are writing COMPLETELY NEW CODE TO PROCESS A BST and this code, although not extremely long, can be VERY TRICKY TO DEBUG and find errors in - thus it will be restated to not delay on this project thinking (incorrectly) that "since project 2 might have been easy, project 3 must be easy as well as it seems very similar" - because it is not the same, and is more like project 1.

Overview

In this project you will implement a binary search tree class template. This class template implementation will be used to replace the DLL<Event,string> class that is used to represent the list of Events in our application. Therefore, instead of defining the eventlist as:

                  DLL<Event,string> eventlist;

                     it will be defined as:

                  BST<Event,string> eventlist;
Minimal changes will be required for the DataManager class so that it can now use a binary search tree to represent the list of events.

After you have implemented this project, you will be able to define binary search trees that not only store Events, but also any object you want. The interface for BST is nearly identical to DLL. Both can store objects that have a getKey() method. All of the classes you could create using the DLL template class can also be created using the BST template class. The following are examples (some of which will not used in this project) of objects with different template class instantiations:

 BST<Event,string> eventlist;  // tree of Events where the primary
                               // key is string.

 BST<Student,int> slist;  // tree of Students where the primary key
                          // is an integer (for example, sid)

 BST<Car,Tag> carlist;  // tree of Cars where each one is identified
                        // via a Tag object.
In the DataManager class, you will change the event list, which was represented using a DLL class template instantiation, to a BST class template instantiation. However, the association member list (amemberlist) of project #2 will still be represented by the DLL class template - MEANING YOU WILL NOT MODIFY IT. You will discover that both template classes are very similar, yet their implementation is quite different.

There will be no additional classes added in this project beyond the class template, BST. You will be using all of the classes you previously defined when implementing Project #2.

We will provide a .h file defining the interface of the BST class template you are expected to implement. In addition, a description for each function of that class will be provided.

Academic Integrity Statement and Acceptable Use Guidelines

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 and below concerning the use of class computer accounts (Acceptable Use Guidelines) and concerning the University's Code of Academic Integrity. The instructors of this course will review all of 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.

Note that "hardcoding" is also considered a violation of academic integrity.

If you are unclear about any of the policies of this course you should ask either of the instructors for further clarification. NOTE: unless explicitly specified otherwise these policies apply to all assignments in this course:

Code of Academic Integrity
Guidelines for Acceptable Use of Computing Resources

Programming Style

All your programs in this course should be written in ANSI C++, which means they must compile and run correctly with "cxx -w0 -std strict_ansi" on the OIT UNIX Class Cluster (dc.umd.edu).

Your program must have a comment near the top which contains your name, login ID, your section number, your TA's name, an estimated time it took to complete the project (in hours) and an original description of the action and operation of the program (thus at least 6 items neatly organized and easy to read).

Your program should be written using good programming style and formatting, as discussed in class and throughout your textbook. For this project, style is considered to consist of:

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.

Note that the FAQ is considered part of the project description and thus just as important to read and review - even after you have submitted a project you should periodically check AND READ any new FAQ's posted. Once the project deadline has passed no new FAQs will be entered for that project and thus you can then stop checking it.

Project Specifications

Overview of the classes

The Name, NameList, Event, AMember and DLL classes you implemented for Project #2 will be used for this project. If you did not complete any parts of Project #2 with respect to those classes, it is your responsibility to fix them before you start working on this project. If those classes listed above have been implemented correctly from Project #2, you should be able to use them in Project #3 without any modifications (just copy the .h and .cpp files from your Project #2 for use in Project #3). Note that in testing Project #2 we may not have tested every aspect of those classes however they may be "retested" when grading Project #3 for things that were tested in Project #2 and for things that weren't tested (but we will not test the extra credit parts of project #1).

A new version of DataManager.h has been provided for you. You will need to make some modifications to the DataManager.cpp file so that it correctly implements the functionality given in the new DataManager.h file.

There will also be a new class template called BST. This class implements a binary search tree. In addition, it keeps an extra "thread" in the BST (almost like a doubly linked-list) so that inorder traversals can be executed over the tree. Although we can have an inorder traversal of a tree without the thread, it is very useful to have it when dealing with iterators (iterators involving next and previous operations).

Classes to implement or modify:

Below, we provide a description of each of the classes you are to implement. For each of these classes there is a .h file that can be found in the posting account. The name for the methods to be described are as specified in the .h files (when in doubt follow the name presented in the .h file). You can modify copies of the files posted only if the project specification below requires or permits you to do so. There are at least two files you are NOT expected to modify: the DataManager.h and main.cpp files (and possibly others).

There may be some references to BNF entries defined in the descriptions of project #1 and #2 (we will not provide the description for those entries in the current project description)

  Class Name     Brief description of the class
Name, NameList,
Event, DLL
and AMember
  Same as in project #2.  
BST   This class template represents an ordered set of items. It is implemented using a binary search tree class template where each node of the tree stores information about the template items in the set. BST will be used to replace the DLL eventlist from project #2.  
BSTIter   This class represents an iterator for the BST class. It will allow us to go through each one of the elements of a BST in increasing order. NOTE: this class will be considered extra credit and worth up to 10 extra points.  
DataManager   The execution of commands (e.g., adding/removing Events) will be possible via this class. In the main() function of the application an object of this class will be created, and any processing requests will be sent to the DataManager object for processing. This class (as well as main.cpp) has been modified for project #2 to incorporate the new additions/modifications.  

Details of the classes to implement

In this project the C++ string class is being used to represent strings. Make sure you include the <string> and not the <string.h> library header file in order to use the C++ string class library.


1) BST class template (File BST.h)
  NOTE: Only the eventlist from project #2 will be "converted" to use
        this BST class template.  The amemberlist will remain a DLL.

a. Template parameters (2 total)
----------------------
  i. BSTData - the first parameter representing the type of the data
               to be stored in the binary search tree.  This type must
               have a getKey() member function which returns a key of
               type, BSTDataKey.

 ii. BSTDataKey - The second parameter representing the type of the key
                  element associated with the kind of element to be
                  stored in the tree.  BSTDataKey should support the
                  following operations: ==, !=, <, >, <= and >=

b. Node definition
------------------
   We have provided a template structure declaration for the the node
   to be used in the BST implementation.  The name of the structure
   node will be: BSTnode  No changes are required for this node.  (In
   particular, don't change BSTnode into a class, i.e., don't add
   member functions to BSTnode).

   The BSTnode structure contains the following data members:

     i. data - a pointer to the data object.  Instead of keeping the
               data object in the BSTnode, we will keep a pointer to
               the object.  That means we will have to dynamically
               allocate a data object for each addition of a data
               element to the tree.

    ii. left - a pointer to the left child of the node.

   iii. right - a pointer to the right child of the node.

    iv. pred - a pointer to the tree node representing the inorder
               predecessor of a node.   This is very similar to the
               "prev" pointer found in a doubly linked list node.
               This pointer will be used for the extra credit - if
               you do not do the extra credit it should be set to
               NULL at all times.

     v. succ - a pointer to the tree node representing the inorder
               successor of a node.  This is very similar to the
               "next" pointer found in a doubly linked list node.
               This pointer will be used for the extra credit - if
               you do not do the extra credit it should be set to
               NULL at all times.

c. Private data members (for the BST template)
-----------------------
   You may NOT add any data members (publich or private) to this class.
   The only data member permitted is the one which already appears in
   the header file and is as follows:

   i. root - a BSTnode pointer representing the root of the tree.

d. Public methods
-----------------
   i. Constructor - Implement the required default constructor for
                    this class.  It should create an empty tree.

  ii. Copy Constructor - Implement the required copy constructor for
                         this class.

 iii. operator= - Implement the required assignment operator for this
                  class.

  iv. Destructor - Implement the required destructor for this class.
                   Read the description of free for more detail.

   v. isEmpty - Returns true if the tree has no elements; false
                otherwise.

  vi. find - Initializes the data object reference parameter with the
             data object of the entry of the tree associated with a
             particular key value; true is returned for this case.
             false must be returned if an entry with a particular key
             value is not found.

 vii. update - If a data object entry of the tree has a key value equal
               to the one associated with the object parameter, then
               the object parameter will overwrite the entry; true will
               be returned for this case.  Otherwise a value of false
               will be returned (no modifications to the structure of
               the tree will occur).

viii. add - Adds a copy of the data object parameter to the tree.  The
            insertion of the data object must be based on the key value
            of the object (lexicographical order is being used).  A
            value of true must be returned if the insertion is
            successful and false otherwise (e.g., an object with the
            same key value is already present).

            If an object is to be inserted in the tree, then a dynamic
            memory allocation of the object will be required.  This
            object will be initialized with the object parameter.  The
            add operation will not overwrite an object with the same
            key value as the object parameter.  The function should
            simply return false if this occurs, and leave the tree
            unmodified.

            When inserting elements in the BST, remember that smaller
            key elements go to the left subtree of the tree, and
            larger key elements go to the right subtree (as explained
            in class).  IMPLEMENTATIONS NOT FOLLOWING THIS APPROACH
            WILL LOSE SIGNIFICANT CREDIT.

            FOR EXTRA CREDIT (up to 10 points):
            -----------------------------------
            In addition to inserting the data object in the tree you
            should adjust the appropriate predecessor and successor
            pointers of the appropriate node(s) so that the inorder
            traversal thread is preserved.

            IF YOU CHOOSE TO NOT DO THE EXTRA CREDIT PART you should
            set the pred and succ pointers to NULL.

  ix. del - If there is a data object with a key value corresponding
            to the parameter, then the data object will be removed
            from the tree; a value of true will be returned in this
            case.  If there is no data object with the specified key
            value in the tree, then a value of false must be
            returned and the tree should be left unmodified.

            DO NOT IMPLEMENT THIS METHOD BY CREATING AN EMPTY BST
            AND THEN PROCEEDING TO ADD ALL THE ELEMENTS FROM THE
            ORIGINAL TREE EXCEPT THE ONE TO BE DELETED.  PROJECTS
            FOLLOWING THIS APPROACH WILL BE CONSIDERED AS NOT
            IMPLEMENTING THE del FUNCTION.

            IF YOU ARE ATTEMPTING THE EXTRA CREDIT:
            ---------------------------------------
            In addition to deleting the data object from the tree
            you must adjust the appropriate predecessor and
            successor pointers of the appropriate node(s) so that
            the inorder traversal thread is preserved.

   x. size - returns the current number of elements in the tree.
             There are several ways to implement this method - if
             you do the extra credit it is an easy method to write
             using the "iterator thread".  Otherwise it can be done
             using a recursive helping function to count the nodes
             in the tree.

  xi. printForward - Prints all the data objects in order (by key
                     value) using the same format used for
                     printForward in a DLL.  You can use the
                     inorder traversal thread in order to print
                     the tree.  Otherwise you can use a recursive
                     function to print the tree inorder.

 xii. printBackward - Prints all the data objects in reverse order
                      (by key value) using the same format used
                      for printBackward in DLL.  You can use the
                      inorder traversal thread in order to print
                      the tree.  Otherwise you can use a recursive
                      function very similar to the one used in
                      printForward.

xiii. getIterator - Initializes the data members of the a BSTIter
                    object so that the iterator allows the future
                    access of elements of the tree.  Multiple
                    iterators can be associated simultaneously
                    with a BST object.  curr can be initialized
                    to anything when calling getIterator, but
                    first and last must be initialized to the
                    first and last node in the inorder travesal
                    of the tree.

                    NOTE: IF YOU ARE NOT DOING THE EXTRA CREDIT
                    then this function MUST return an iterator
                    such that first, last and curr are all NULL.

 xiv. printTree - Prints the key values of a tree in an horizontal
                  fashion.  For example, given the following tree:

                                  A

                              B       C

                  the method will output the following:

                            C



                  A



                            B

                  Empty subtrees will be represented by a *
                  character.

   We have provided the code for the printTree function to assist you
   in the process of debugging and visualizing your tree.  You can
   find the implementation of the function in the BST.cpp file
   provided in the posting account.

e. Private methods
------------------
   You do not have to implement the private methods provided but you
   may not modify them (meaning you must leave them in the .h).  You
   are encouraged to write these methods as they may be very useful,
   also you may write additional private "helping" functions as you
   feel necessary.

   i. locate - Locates a node in the tree that has a particular key
               value returning a pointer to the node found; NULL will
               be return in the case where no such node is found.

  ii. free - Returns to the memory heap the dynamically-allocated
             memory representing the binary search tree.  The root
             pointer should eventually be set to NULL, since the free
             method results in an empty tree.

 iii. copy - Makes the current object a copy of the object passed
             as a parameter.  YOU MUST USE RECURSION IN ORDER TO
             IMPLEMENT THIS FUNCTION.  THIS FUNCTION MUST GENERATE
             A TREE COPY THAT HAS THE SAME SHAPE AS THE SOURCE TREE.
             YOU WILL LOSE CREDIT IF YOU DON'T SATISFY THIS
             REQUIREMENT.

             The copy method should make a deep copy of the tree
             (meaning, all nodes and data must be copied by dynamic
             allocation, and not by simply copying pointers).

  iv. printTreeAux - An auxiliary (helping) function used to print
                      the tree.  The actual implementation can be
                      found in the posted BST.cpp file.

e. Additional info
------------------
    i. You must use the specified template parameter names provided.

   ii. Your implementation must be in a file named BST.cpp

  iii. You may not modify any of the prototypes or the parts found
       in the header file.

   iv. You may add private methods to the BST class and are encouraged
       to do so - in particular you may find some helper recursive
       functions very useful (and good practice).

    v. You can assume that any data component (e.g., Event object)
       class used with the class template BST will have a method
       getKey() const returning the value of the key and that this
       value will match the type of the BSTDataKey parameter provided.

   vi. You must have the minimum number of nodes in the tree at all
       times (no addition of "dummy/header" nodes for example).

  vii. You are encouraged to use the printTree function for debugging
       purposes as you implement this class.

2) BSTIter class (File BST.h)
  NOTE: The declaration for this class is in the BST.h file.  The
        methods must be implemented in the BST.cpp file.

ADDITIONAL NOTE: This class is for extra credit and not required (as
                 specified above).

a. Private data members
-----------------------
   i. first - Pointer set to the first node of the inorder traversal
              tree.  There are several ways to set the pointer to
              this node.

  ii. last - Pointer set to the last node of the inorder traversal
             tree.  There are several ways to set the pointer to
             this node.

 iii. curr - Pointer set to a particular node considered the current
             node at the time.

b. Public methods
-----------------
   i. Constructor - No implementation is required.

  ii. Copy Constructor - No implementation is required.

 iii. Destructor - No implementation is required.

  iv. operator= - No implementation is required.

   v. goFirst() - Sets the BSTIter curr pointer to the first node in
                  the inorder traversal thread.

  vi. goLast() - Sets the BSTIter curr pointer to the last node of
                 the inorder traversal thread.

 vii. goNext() - Sets the BSTIter curr pointer to the next node in
                 the inorder traversal thread.

viii. goPrev() - Sets the BSTIter curr pointer to the previous node
                 in the inorder traversal list.

  ix. getCurrent() - Returns the data object associated with the
                     BSTIter curr pointer.

   x. isOffList() - Returns true if the value of the BSTIter curr
                    pointer is not pointing to an element of the
                    inorder traversal thread; false otherwise.

c. Additional info
------------------
   i. You cannot add any public methods.

  ii. You cannot add private methods or data members (public or
      private) to this class.

 iii. Remember that you can have several iterators associated with
      the tree.  Each one of them can be at a different point in
      the tree.

  iv. The user of this class must check that the execution of
      goNext(), and goPrev(), and getCurrent() will be valid
      (by using the isOffList() method).

   v. You must not modify the tree when you are accessing it
      via iterators.

3) DataManager class (File DataManager.h)
a. Private data members
-----------------------
   i. eventlist - BST object representing a list of Event objects where
                  the key is the title of the Event (a string).  NOTE
                  THAT THIS MUST USE A BST OBJECT TO REPRESENT THE LIST
                  OF EVENTS.

  ii. amemberlist - DLL object representing a list of AMember objects
                    where the key is the Name of the member (a Name).
                    NOTE THAT THIS HAS NOT CHANGED FROM PROJECT #2 AND
                    YOU MUST NOT USE A BST FOR THIS - it must remain
                    a DLL object.

b. public methods
-----------------
   You will modify the methods previously implemented in Project #2,
   so that they can now work with the template classes defined.  YOU
   WILL NOT CHANGE THE PUBLIC INTERFACE PROVIDED in the DataManager.h
   file we have provided for Project #3.  You must use this new version
   of the DataManager.h file and not the one provided for Project #2.

   The following is the new method that has been added to the DataManager:

    i. printTree - prints the tree representing the Event list to the
                   standard output stream.

c. BNF
------     
   No new ones needed (see project #2 and project #1).

5) Inputs and Outputs
a. Your project will read commands that will be processed by the main()
   function in the main.cpp file.  Note that unless specified otherwise
   all input will come from standard input (cin) and all output
   should go to standard output (cout).  If you are debugging
   your code you can print to cerr or cout just remember to remove or
   comment out all debug statements when you submit otherwise you may
   lose substantial credit.

b. The commands used in Project #2 in the input (ADDEVENT, ADDTOPART,
   ..., FINEVENTSOF, ...) will be available in this project and they
   must work as specified in Project #2.  Note: You do not need to
   do the extra credit parts of project #1 and they will not be
   retested in project #2.

c. The following command has been ADDED for this project (the BNF
   for the command follows): 

       i. PRINTTREE - prints the tree representing the list of events
                      using the printTree() method.  The BNF entry
                      for this command is as follows:

         <actual_command> ::= <print_tree_com>

         <print_tree_com> ::= "PRINTTREE"

6) main() function (File main.cpp)
a. We will use a main function (provided in a file called main.cpp available
   in the posting account) that will read commands from the user and then
   call the appropriate DataManager method in charge of handling the command.
   YOU CANNOT MODIFY THIS main.cpp FILE IN ANY WAY.  It is considered the
   driver of the whole application and we will use it to compile your
   system during grading.

b. The main.cpp main() function has for each one of the possible operations
   in the DataManager class an entry that allow us to execute that operation
   with a set of values provided in the input.  For example, if we want to
   add an event, then the addEvent method of the DataManager will be called
   after the command name (a C++ string class object in capitals called
   "ADDEVENT") followed by the event information (as defined in <event_in>)
   have been read from the standard input.  Check the main.cpp file in order
   to identify each of the command strings to be used.

Miscellaneous Requirements

  1. Many requirements for the implementation of this project have been specified throughout the methods description provided above; double check those requirements are satisfied by your project.
  2. You must use the BST<Event,string> eventlist data member in order to keep track of Events.
  3. You must use the DLL<AMember,Name> amemberlist data member in order to keep track of association members.
  4. Any iterations required over the association list or the event list in the DataManager class should be done using the required template class iterators (when possible and if the extra credit is done).
  5. There must be a file called BST.cpp that will contain the class template(s) corresponding to the binary search tree.
  6. You must have an instantiation file named Instantiations.cpp   Every template class used by your program must be instantiated in this file. Your program must link in this instantiation file when compiling the executable.
  7. The DLL class MUST IMPLEMENT A TEMPLATIZED DOUBLY-LINKED LIST OTHERWISE YOU WILL RECEIVE A GRADE OF 0 FOR THIS PROJECT EVEN IF YOUR PROJECT GENERATES THE PRIMARY OUTPUT.
  8. The BST class MUST IMPLEMENT A TEMPLATIZED BINARY SEARCH TREE OTHERWISE YOU WILL RECEIVE A GRADE OF 0 FOR THIS PROJECT EVEN IF YOUR PROJECT GENERATES THE PRIMARY OUTPUT.
  9. Primary Output Requirements - Your project must generate results that match the primary output when run with the primary input and the main.cpp file provided. The results generated by your program will be considered correct if and only if this command reports no differences. The expected primary input and output are available in the posting account. ANY PROJECT NOT GENERATING THE CORRECT PRIMARY OUTPUT WILL RECEIVE A GRADE OF 0.
  10. YOU CANNOT ADD FRIEND CLASSES AND/OR FRIEND FUNCTIONS to any of the classes in this project. We have already specified in the .h files which functions and/or classes are friends.
  11. YOU CANNOT MODIFY THE HEADER FILES IN ANY WAY except when explicitly stated otherwise (and only as explicitly stated otherwise). You may write "helping" code inside the source (.cpp) files as you see fit/necessary however you can NOT have any global variables (with the exception that global constants would be allowed).
  12. YOU MUST USE THE main.cpp FILE WE HAVE PROVIDED.
  13. YOU CANNOT USE INHERITANCE, NOR THE STL (Standard Template Library) IN ORDER TO IMPLEMENT THIS PROJECT.
  14. You can NOT use files or any type of fstreams in this project.
  15. During the grading of your project, we may test your code with a main.cpp that is different from the one we provided. That means that those functions not necessarily tested by the main.cpp posted may be tested. Make sure that copy constructors, destructor and assignment operators have been implemented in such a way they work correctly no matter what main.cpp we provide.
  16. Your code must not produce memory leaks. As long as it does not have leaks nor does it "wastefully" use dynamic memory, you may assume that memory allocations will always be successful.

Hints

  1. Although this project is not as long as the last one, you must start working on it immediately (plus you have less time to work on it than the last one). DO NOT WAIT UNTIL FEW DAYS BEFORE THE DEADLINE. Office hours are usually crowded the days before the deadline; if you wait until the last minute you might not be able to get the help you need and it will be very difficult to complete all the required tasks in time.
  2. Start by fixing (if necessary) the "supporting" classes (Name, NameList, Event) before you move on to the harder parts.
  3. For each class you implement, you should (must) have a test driver that verifies the methods have been implemented correctly. Save those test drivers for future reference.
  4. Keep backups of your projects (in a special directory separate from the one you do your main working in).
  5. Remove any unnecessary files from your account. The compilation process can be interrupted if not enough disk space is available (familiarize yourself with the UNIX quota command).
  6. See the FAQ online throughout the project for other possible hints.

Makefile

For this project (and the rest of them) you must make a UNIX Makefile to manage the compiling of your project. The makefile must be named makefile and should be written so that the first target is p3 and that typing make p3 or just make will result in the necessary files being compiled to create the executable p3 which can then be run as specified below in the Sample I/O section. Note that your makefile should create (and leave) the necessary .o (object) files and should not recompile unnecessarily (meaning it should not have redundant/incorrect dependency lists for the targets). Your makefile does not have to have any "extra" targets such as make clean or make tar however it is ok if it does.

The makefile must use the cxx compiler with the -w0 and the -std strict_ansi options when compiling.

NOTE THAT YOUR PROJECT WILL NOT SUBMIT UNLESS IT HAS A WORKING MAKEFILE and thus you are strongly encouraged to test this well in advance of the due date to make certain your makefile is working properly. If you have difficulty using the makefile reread the makefile tutorial in the posting account:

~fjm14001/Tutorials/Miscellaneous/makefile+tar.g++
and then if necessary see someone in office hours as soon as possible.

When compiling your program should not generate any compiler warning messages.

Sample I/O

For this project you will be provided with a primary.input and primary.output file. Both of these files can be found in the posting account in the appropriate directory. YOU SHOULD COPY THE primary.input FILE FROM THE POSTING ACCOUNT - DO NOT ATTEMPT TO TYPE THIS FILE IN OR CUT AND PASTE IT FROM THE WEBPAGE - INSTEAD, COPY IT (using the UNIX cp command) DIRECTLY FROM THE POSTING ACCOUNT.

In order to pass the MRC (minimum running criteria) for this project your program must generate the primary.output when tested with the primary.input as follows:

%  make  p3
%  p3  < primary.input  > my.output
%  diff  -bwi  primary.output  my.output
%

The first line (make p3) is the step to compile the project - note that you should strive to have NO COMPILER WARNINGS (points may be deducted for having compiler warnings). Note once again: you must use the cxx compiler in your makefile and that the -w0 and -std strict_ansi options must be used (points may be deducted for failing to use the compiler and options specified).

The second line (p3 < prima...) is a way to run the p3 program and redirect input (<) to come from the primary.input file (instead of the keyboard) and have the output redirected (>) to the file my.output (instead of the screen).

The third and final line (diff -bwi ...) is how we will test to make sure that your output (my.output) matches the expected output (primary.output). The diff command will print to the screen any lines in your file that do NOT match with the corresponding lines in the other file - if nothing gets displayed that is good news - it means that your output matches the expected output. The -bwi options tell the diff command to ignore case (be case-insensitive) and to ignore extra blank spaces. You should strive to have your output diff with the primary.output without the -bwi options, as that forces you to have a "more perfect" match - however when grading we will always use the -bwi option.

Files Provided

In the posting account, in the ~fjm14001/Projects/P3/ directory, there are the following files (and possibly others):

     main.cpp        BST.h       BST.cpp       DataManager.h   
You must use these files when creating your project and you may not create any other files for this project (besides those from project 2) with the exception of a makefile - which will be used when your project is tested - and the necessary .cpp files (source files - at most one per .h file). You should "reuse" the files necessary from project #2 (Name.h, NameList.h, DLL.h, DLL.cpp, ...).

When we test your project we will compile it as follows:

%  make  p3
or we may just type:
%  make
and thus your first "target" in your makefile should be p3.

How to Submit

IT IS VERY STRONGLY RECOMMENDED THAT YOU ATTEMPT TO SUBMIT THIS (and every) PROJECT AT LEAST ONE FULL DAY (24-hours) IN ADVANCE. In particular no extensions will be granted for problems encountered in trying to get your program to submit unless there is an error that the majority of students encounter with the submit program we provide and/or the corresponding instructions. Additionally you should make a safe backup copy of all your work PRIOR to beginning the process to submit your project (as described below).

For this project you must "tar" and submit the following files (primarily consisting of the source (.cpp) and header (.h) files used by your implementation including your makefile):

     DataManager.h    Event.cpp       Name.h          NameList.h
     DataManager.cpp  DLL.h           Name.cpp        NameList.cpp
     Event.h          DLL.cpp         main.cpp        makefile
     AMember.h        AMember.cpp     Instantiations.cpp
     BST.h            BST.cpp
NOTE THAT YOUR FILES MUST BE NAMED EXACTLY AS SPECIFIED AND IF THEY ARE NOT YOU MAY LOSE SIGNIFICANT CREDIT.

You must do this using the tar command similar to how it was used in project #2 - double check your tar file to make sure it has all of the required files and no other extra files. Points may be deducted if your tar file contains extra files. IN PARTICULAR: your tarfile should NOT contain any extra files other than those needed to create the executable p3 and it must contain all those text files (.cpp, .h and makefile) necessary to create p3.

NOTE THAT YOUR source files (.cpp) must be named the same as the corresponding header files (.h) - so for example the source file corresponding to Event.h must be named Event.cpp (which is just Event.h with the .h replaced by the .cpp).

WARNING - BE VERY CAREFUL USING THE UNIX TAR COMMAND - if you use the command incorrectly it may automatically DELETE (permanently) one or more of your files. Make a backup copy of your files before running the tar command. In particular the filename IMMEDIATELY after the -cvf in the tar command, must be the name of the file that you want to CREATE and put the other files into. If that file already exists it (the tar command) will automatically DELETE it and create a new one and if the file doesn't exist tar will just create a new one. To find out more about the tar command there is a "tutorial" in the posting account in the ~fjm14001/Tutorials/ directory also you can type "man tar" at the UNIX prompt to read the man page.

DO NOT EDIT YOUR TARFILE - it turns out that a tar file is a plain text file that you can read, but it may look "weird" inside - that is the way the tar file works and if you modify the tar file IT WILL NOT WORK ANYMORE and we will not be able to test your program.

After you have created the tar file you must then turn in (or submit) that file to us. The way that you do this is that you can type:

%  submit  proj3.tar  3
at the UNIX prompt and that will run the submit program and attempt to turn in the file proj3.tar from the current directory for project #3.

The submit command will generally display information to the screen and you should read that information to make sure your project submits successfully - if you do not see a message stating that your project was submitted then you should assume that it did not get submitted.

We will not accept projects submitted in any other way.

You may submit a project more than once - note however that only the last file you submit will be used for grading purposes - meaning that if you submit twice ontime and then once two days late only the last submission will be graded (the two day late version in this case). See the course syllabus for other details regarding late submissions.

NOTE: you should make a backup copy of all of your work on a regular basis. We will not grant extensions due to mistakenly deleted files or individual computer troubles. It is also recommended that if you do work and store your files on a personal computer you regularly backup those files by copying them into your class account (at least once a day during any of the days you work on your files).


DOUBLE CHECK WHAT YOU SUBMITTED to make sure that it is correct - in particular create a subdirectory and copy the file you submitted into that subdirectory and then untar it (tar -xvf) and check the contents to make sure they are correct - in particular compile and test the files that were extracted from the tar file. If there is a problem with the tar file you should fix it and try again.


See the class syllabus for policies concerning email
Last Modified: Sat Oct 16 10:32:12 EDT 2004
and on: Wed Oct 20 17:16:39 EDT 2004 near top 8% was changed to 10%
left up down right home