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 #1

Due Tuesday, September 28th, by 11PM

Preliminary Material

Project 1 is worth 7% of your grade.

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.

Purpose

Create several ADTs using C++ classes, composition of classes and linked lists. Understand abstraction concepts.

Overview

In this project you will develop an application to manage a collection of olympic athletic events. An event has a title, year started, venue, and other information associated to it. The application you are to write will enable a user to add/remove events to the set of events, process queries, and execute some other tasks to be described below. For example, a possible query could be to print the title of all events in a particular venue. An ordered list, implemented using a doubly-linked list data structure will be used to represent the collection of events.

We will provide a collection of .h files defining the interface of the classes you are expected to implement. In addition, a description for each of these classes will be provided. You may want to take a look at the Primary Input/Output provided in the posting account for an example of the input and output your project is expected to handle.

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.

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.

Project Specifications

Overview of the classes

The application you will develop has six classes associated with it:

  Class Name     Brief description of the class
Name   This class represents an individual's name. The representation of a name involves first and last name.  
NameList   The NameList class represents a list of Name class objects. This list will be implemented as a dynamically-allocated array of Name objects.  
Event   This class represents an olympic athletic event. It stores information about the title, venue, participants, and other items associated with an Event. Information about the participants of an Event will be available by using a NameList object.  
EventList   This class represents the ordered list of Events. It is implemented using a doubly-linked list data structure where each node of the list stores information about an Event object (among other things).  
EListIter   This class represents an iterator. It will allow us to go through each one of the elements of an EventList.  
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.  

Details of the classes to implement

Below, we provide a description of each of the classes you are to implement. For each of these classes there is a .h file which 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 modified: the DataManager.h and the main.cpp files (and possibly others).

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.

The following BNF entries will be used in the description below:

      <empty> ::= (represents the epsilon (nothing) choice)
       <endl> ::= (newline character)
    <integer> ::= (any integer value between 0 and 10000)
 <projstring> ::= (any combination of one or more letters or digits
                         with no blank characters)
      <blank> ::= ' '
     <blanks> ::= <blank><blanks> | <blank>
<maybeblanks> ::= <blanks> | <empty>
         <ws> ::= <endl> | <blanks> | <ws><endl> | <ws><blanks>
    <maybews> ::= <ws> | <empty>

NOTE: for those students unfamiliar with BNF grammars there is a tutorial available in the class posting account and is the following file:

~fjm14001/Tutorials/Miscellaneous/bnf.handout
The BNF's used in this project description (and in future ones) roughly follow the common BNF format specified in that tutorial with small deviations which should be easily understood.

When we refer to lexicographical order in the description below we are basically referering to alphabetical order. We prefer lexicographical because some strings can have numbers (e.g., the title of an Event could be event1 or event2). Note that lexicographical order is case-sensitive and the C++ string class operator< compares two strings s1 and s2 such that if s1 < s2 is true then s1 is considered less than s2 lexicographically.


1) Name class (File Name.h)
a. Private data members
-----------------------
  i. lastname - C++ string class object representing the last name of a person. 
 ii. firstname - C++ string class object representing the first name of a
                 person. 

b. public methods
-----------------
   i. Constructor - This constructor will have default values of "NONE" for
                    lastname and firstname.  

  ii. Copy Constructor - You must determine whether it is necessary to
                         implement this method or not.

 iii. Destructor - You must determine whether it is necessary to implement
                   this method or not.

  iv. operator= - You must determine whether it is necessary to implement
                  this method or not.

   v. operator== - equality operator.  Two Name objects will be considered 
                   equal if they have the same values for the corresponding 
                   lastname and firstname data members.  

  vi. operator!= - inequality operator.  Two Name objects will be considered
                   different if either or both of their corresponding
                   lastname and firstname are different. 

 vii. operator< - less than operator.  A Name object will be considered 
                  less than another Name object if the former precedes
                  lexicographically the latter.  Name comparisons will
                  compare lastname first followed by a firstname comparison
                  if necessary.

viii. operator> - greater than operator.  A Name object will be considered 
                  greater than another Name object if the former follows
                  lexicographically the latter.  Name comparisons will
                  compare lastname first followed by a firstname comparison
                  if necessary.

  ix. operator<= - less than or equal operator.  A Name object will be 
                   considered less than or equal to another Name object if
                   the former precedes lexicographically the latter or if
                   it is the same.  Name comparisons will compare lastname
                   first followed by a firstname comparison if necessary.

   x. operator>= - greater than or equal operator.  A Name object will be 
                   considered greater than or equal to another Name object if 
                   the former follows lexicographically the latter or if it 
                   is the same.  Name comparisons will compare lastname first 
                   followed by a firstname comparison if necessary.

  xi. operator>> - You must overload the input operator so that the input
                   data replaces the contents of the current object.  The
                   input is described by the BNF entry <name_in>
                   (Note that this is a not exactly a "method" of the class
                    but is listed here for convenience and this will be true
                    below for a few other similar functions)

 xii. operator<< - You must overload the output operator.  The output is
                   described by the BNF entry <name_out>
                            
c. BNF
------
    <name_in> ::= <maybews><firstname><ws><lastname>

   <name_out> ::= <firstname><blank><lastname>
  <firstname> ::= <projstring>
   <lastname> ::= <projstring>

d. Additional Info
------------------
  i. You cannot add any public methods (except the copy constructor,
     destructor and assignment operators if you think any of them are
     necessary).  NOTE: you should not implement the copy ctor, dtor
     and operator= if they are not necessary, however if they are
     necessary for "safe" use of your class (no memory leaks, etc.) 
     then you must implement them - points may be deducted if you
     implement them when they are not needed or you do not implement
     them and they should be.  This applies to all classes you
     implement in CMSC 214 unless explicitly stated otherwise.

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

iii. You can add private "helping" methods if you want (for example a free()
     or copy() method).

 iv. You cannot add friend functions or anything else to this .h (header) file.

2) NameList class (File NameList.h)
a. Private data members
-----------------------
  i. array_size - integer representing the size of the dynamically-allocated
                  array.
 ii. array - pointer to a Name object.  array represents the dynamically-
             allocated array of Name Objects.

b. public methods
-----------------
   i. Constructor - Defines an array of zero size.  Sets array data member 
                    to NULL.

  ii. Copy Constructor - You must determine whether it is necessary to implement
                         this method or not.

 iii. Destructor - You must determine whether it is necessary to implement this
                   method or not.

  iv. operator= - You must determine whether it is necessary to implement this
                  method or not.

   v. isEmpty - returns true if the list is empty; false otherwise.

  vi. find - Takes as parameter a Name object and returns true if that object
             is present in the list; false otherwise.

 vii. add - Takes as parameter a Name object; adds the parameter to
            the current object list.  The object will be added so that
            the list is sorted lexicographically by lastname followed by
            firstname.  If the passed object can be added to the list the 
            method will return true; if the Name is already present in the
            list, the list must not be modified in any way and false must
            be returned.

viii. del - Takes as parameter a Name object; if the element is found
            in the list the entry will be deleted and the method will return
            a true value; Otherwise a value of false will be returned
            and the list must not be modified.

  ix. size - returns the current number of elements in the list.
 
   x. operator>> - You must overload the input operator so that the input
                   data replaces the contents of the current object.  The
                   input is described by the BNF entry <namelist_in>
                   The Name objects read in should be stored so that the list
                   is sorted in lexicographical order.
                            
  xi. operator<< - You must overload the output operator.  The output is
                   described by the BNF entry <namelist_out>

d. BNF
------
        <namelist_in> ::= <maybews><namelist_size><ws><actual_namelist>
      <namelist_size> ::= <integer>
    <actual_namelist> ::= <namelist_nonempty> | <empty>
  <namelist_nonempty> ::= <name_in><ws> |
                          <namelist_nonempty><name_in><ws>

           <namelist_out> ::= <namelist_out_nonempty> | <empty>
  <namelist_out_nonempty> ::= <name_out><endl> | 
                              <namelist_out_nonempty><name_out><endl>

Note: <name_in> and <name_out> are defined earlier above.

e. Additional Info
------------------
  i. You cannot add any public methods (except the copy constructor, 
     destructor and assignment operators if you think any of them are 
     necessary - if so you must implement them otherwise you shouldn't).

 ii. You can add any private data members and private methods you want to
     this class as long as the data members and functions specified above
     are implemented.  You cannot add any public data members.

iii. The array must have the minimum size possible at all times after
     any of the member functions above have finished running.

 iv. You must implement the list using a dynamically-allocated array.

  v. When reading the list of names, you can assume that input and the
     number of names will always be correct.  That is, the number will be
     followed by a correct number of Name entries.  It is possible (but
     rare) that duplicate names could appear in the input (in which case
     only one copy should be stored).

3) Event class (File Event.h)
a. Private data members
-----------------------
  i. title - C++ string class object representing the title of the event.  
 ii. year - integer representing the year the event became an olympic
            event.  
iii. venue - C++ string class object representing where the event will
             be held.
 iv. start_day - integer representing the day that the event will start
                 (for example 1 would be the 1st day of the olympics
                  while 8 would represent the 8th day).
  v. duration - integer representing the number of days the event will
                will run (for example 2 would mean that it would run for
                2 days - all events will run consecutively meaning that
                if the event starts on the 8th day and the duration is
                3 (days) then it will finish on the 10th day).
 vi. participants - a NameList object used to represent the names of
                    the people participating in this event.

b. public methods 
-----------------
   i. Constructor - This constructor will have default values of "NONE", 0, 
                    "NONE", 0, 0, and an empty NameList for title, year,
                    venue, start_day, duration and participants respectively.

  ii. Copy Constructor - You must determine whether it is necessary to implement
                         this method or not.

 iii. Destructor - You must determine whether it is necessary to implement this
                   method or not.

  iv. operator= - You must determine whether it is necessary to overload this 
                  operator.

   v. getKey - returns the title (this method is for future use).

  vi. getTitle - returns the title.

 vii. getYear - returns the year.

viii. getVenue - returns the venue.

  ix. getStartDay - returns the start_day.

   x. getDuration - returns the duration.

  xi. getParticipants - returns a NameList object representing the participants.

 xii. comparison operators - The equal, not equal, less than, less than or
                             equal, greater than and greater than or equal
                             operators must be overloaded.  Events will be
                             compared based only on their title data member.
                             For example, two Event objects will be considered
                             the same as long they have the same title (no
                             matter the value of the other fields).  

xiii. operator>> - You must overload the input operator.  You must
                   use the readin method (to be described below) for the 
                   overloading.

 xiv. operator<< - You must overload the output operator.  You must
                   use the writeout method (to be described below) for the 
                   overloading.
                
c. Private methods 
------------------
  i. readin - sets the current object with information read from the
              designated input stream.  The input BNF entry is
              <event_in>
              Returns the input stream used.  This method MUST BE USED by
              the input operator (operator>>).

 ii. writeout - sends information about the current object to the designated
                output stream using a format defined by the BNF entry
                <event_out>
                Returns the output stream used.  This method MUST BE USED by
                the output operator (operator<<). 

d. BNF
------
  <event_in> ::=
       <maybews><title><ws><year><ws><venue><ws><start><ws><duration><ws><namelist_in>

     <title> ::= <projstring>
      <year> ::= (integer value between 1896 and 2100)
     <venue> ::= <projstring>
     <start> ::= <integer>
  <duration> ::= <integer>
          
   <event_out> ::=
       "Title: "<projstring>", Year: "<integer>", Venue: "
                <projstring>", Start Day: "<integer>", Duration: "
                <integer><endl><participants>
<participants> ::= "Participants: "<endl><namelist_out>
            
e. Additional Info
------------------
  i. You cannot add any public methods (except the copy constructor,
     destructor and assignment operators if you think any of them are
     necessary).

 ii. You cannot add data members (public or private) to this class or
     make any other changes to the header file other than those explicitly
     permitted.

iii. You can add private helping methods to this class.

 iv. Note that Event titles will be a single word (e.g., Swimming,
     BeachVolleyball, Event1, etc.)

4) EventList class (File EventList.h)
a. EListnode structure
----------------------
  Both the EventList class and the EListIter class use a structure called
  EListnode.  EListnode represents a node of the doubly-linked list.  The
  structure has the following fields:

  i. data - a pointer to an Event object.  Instead of keeping the Event object
            in the EListnode, we will keep a pointer to the object.  That means
            we will have to dynamically allocate an Event object for each
            addition of an Event to the list.
 ii. next - a pointer to the next node in the list.
iii. prev - a pointer to the previous node in the list.
 
b. Private data members
-----------------------
  i. first - EListnode pointer representing the first node of the linked-list.
 ii. last - EListnode pointer representing the last node of the linked-list. 

c. public methods
-----------------
   i. Constructor - Implement the required default constructor for this class
                    (such that the list is initially empty).

  ii. Copy Constructor - Implement the required copy constructor for this class
                         (required, meaning that you must write it).

 iii. Destructor - Implement the required destructor for this class.

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

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

  vi. find - searches for the title in the list and returns false if it is
             not found, otherwise it returns true and it sets the reference
             parameter to be a copy of the Event object in the list
             associated with that title.

 vii. update - If an Event object entry of the list has a title 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 list will occur).

viii. add - Add the Event to the list.  The insertion of an Event must keep
            the list sorted in lexicographical order (by title).  A value of
            true must be returned if the insertion is successful and false
            otherwise (if the Event is already in the list absolutely no
            changes to the list should be made and this is the case where
            false is returned).

            If an Event is to be inserted in the list, then a dynamic memory 
            allocation of an Event object will be required.  This object will
            be initialized with the object parameter.  Also the allocation of
            a node object will be required as well.

  ix. del -  If there is an Event with a title corresponding to the parameter, 
             then the event will be removed from the list; a value of true will
             be returned in this case.  If there is no Event with the specified
             title in the list, then a value of false must be returned.  YOU
             CANNOT IMPLEMENT THIS METHOD BY CREATING AN EMPTY LIST AND THEN
             PROCEEDING TO ADD ALL THE ELEMENTS FROM THE ORIGINAL LIST EXCEPT
             THE ONE TO BE DELETED.  PROJECTS FOLLOWING THIS APPROACH WILL BE
             CONSIDERED AS NOT IMPLEMENTING THE del FUNCTION.

             Remember that you must not only deallocated the node of the
             entry to be deleted but also the actual Event object.
                        
   x. size - returns the current number of elements in the list.  

  xi. printForward - Prints all the Events in lexicographical order (by title)
                     See output BNF entry <print_forward> below.

 xii. printBackward - Prints all the Events in reverse lexicographical order 
                      (by title).  See output BNF entry <print_backward> below.
 
xiii. getIterator - returns an EListIter object which contains an iterator
                    that refers to the first element of the EventList object.
                    Multiple iterators can be associated simultaneously with
                    an EventList object.

d. Private methods 
------------------
All 3 of the following private methods are optional, but highly recommended:

  i. locate - Locates a node in the list that has a particular title value
              and returns a pointer to that node or NULL if no such node
              exists in the list.

 ii. free - Returns to the memory heap the dynamically-allocated memory
            representing the linked-list.
 
iii. copy - Makes the current object a copy of the object passed as a
            parameter.

e. BNF
------
  <print_forward>
            ::= <forward_header><forward_list><forward_footer>
 <forward_header> 
            ::= "**************** Printing Events Forward ****************"<endl>
 <forward_footer> 
            ::= "************** End Printing Events Forward **************"<endl> 

   <forward_list>
            ::= <forward_list_nonempty> | <empty>
  <forward_list_nonempty> 
            ::= <event_out> | <forward_list_nonempty><endl><event_out>

  <print_backward> 
            ::= <backward_header><backward_list><backward_footer>
  <backward_header> 
            ::= "**************** Printing Events Backward ****************"<endl>
  <backward_footer> 
            ::= "************** End Printing Events Backward **************"<endl>

  <backward_list>
            ::= <backward_list_nonempty> | <empty>
  <backward_list_nonempty> 
            ::= <event_out> | <backward_list_nonempty><endl><event_out>

f. Additional Info 
------------------
  i. You cannot add any public methods to the EventList class.

 ii. You can add any private data members and private methods you want to
     the EventList class as long as the data members and methods specified
     above are implemented.  You cannot add any public data members to the
     EventList class.

iii. You must have the minimum number of nodes in the list at all times
     (no addition of "dummy/header" nodes in the list).

 iv. You cannot modify the EListnode structure, and you cannot transform it
     into a class.

5) EListIter class (File EventList.h)
  NOTE: The declaration for this class is in the file EventList.h.  The
        methods must be implemented in the EventList.cpp file.

a. Private data members
-----------------------
  i. first - Pointer set to the first node of the list.  
 ii. last - Pointer set to the last node of the list.
iii. curr - Pointer set to a particular node considered the current node
            at the time (initially the first node in the list). 

b. public methods
-----------------
   i. Constructor - No implementation is required (meaning it can not be
                    added).

  ii. Copy Constructor - No implementation is required.

 iii. Destructor - No implementation is required.

  iv. operator= - No implementation is required.

   v. goFirst() - Sets the EListIter curr pointer to the first node in the list.

  vi. goLast() - Sets the EListIter curr pointer to the last node of the list.

 vii. goNext() - Sets the EListIter curr pointer to the next node in the list.

viii. goPrev() - Sets the EListIter curr pointer to the previous node in 
                 the list.

  ix. getCurrent() - Returns the Event associated with the EListIter curr 
                     pointer.

   x. isOffList() - Returns true if the value of the EListIter curr pointer is 
                    not pointing to an element of the list; 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. Don't confuse the first and last data members of the EListIter
      class with the first and last data members of the EventList class.
                            
  iv. Remember that you can have several iterators associated with the list.
      Each one of them can be at a different point of the list.

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

  vi. The user of this class must check that execution of getCurrent() is
      done when the iterator is pointing to an entry of the list.

 vii. You must not modify the list when you are accessing the list via 
      iterators.

viii. Note that the iterator may become "invalid" if any nodes are
      inserted/deleted/etc. into the list.

6) DataManager class (File DataManager.h)
a. Private data members
-----------------------
   i. eventlist - EventList object representing the list of events.

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. addEvent - Adds the event represented by the parameter to the list.  If 
        the add operation is successful then a message according to <add_succ>
        will be generated.  Otherwise, a message according to the <add_fail>
        will be generated (BNF entries can be found below).

  vi. addToParticipants - Adds the name to the participant list associated
        with the specified event.  If the add operation is successful a
        message according to <add_to_part_succ> will be generated.
        Otherwise, a message according to <add_to_part_fail> will be
        generated.

 vii. delEvent - Deletes the event with the specified title from the list.  
        If the operation is successful, a message according to <del_succ>
        will be generated.  Otherwise a message according to <del_fail>
        will be generated. 
                                 
viii. delFromParticipants - Deletes the specified name from the participants
        list associated with the event whose title was provided in the
        parameter list.  If the operation is successful a message according to
        <del_from_part_succ> will be generated.  Otherwise a message
        according to <del_from_part_fail> will be generated.

  ix. printEventListForward - Prints the list of events according to the
                              BNF entry <print_forward_manager>

   x. printEventListForward - Prints the list of events according to the
                              BNF entry <print_backward_manager>

  xi. findEvent - Determines whether an event with the specified title 
        exists in the list or not.  If the event is found information will be
        printed according to the BNF entry <find_event_succ> otherwise
        information will be printed according to the BNF entry <find_event_fail>

 xii. findEventsOf - Determines all the events a person with the specified name
        is part of.  If any events are found a message according to the BNF
        entry <find_events_of_succ> will be generated; Otherwise a message
        according to <find_events_of_fail> will be generated.  The list of
        event titles must be printed in lexicographical (forward) order.

xiii. findEventsBetYear - Determines all the events added between two
        particular years, inclusive.  If any events are found, a message
        according to the BNF entry <find_events_bet_year_succ> will be
        generated.  Otherwise a message according to <find_events_bet_year_fail>
        will be generated.  The list of event titles must be printed in 
        lexicographical (forward) order.  You can assume the second year will
        never be smaller than the first one.

 xiv. findVenueSchedule - Finds all the events in the list at a particular venue.
        If any events are found a message according to the BNF entry
        <find_venue_succ> will be generated.  Otherwise a message
        according to <find_venue_fail> will be generated.  The
        list of event titles must be printed in order by when the events start
        at the venue (according to the start_day) with the earlier events
        being listed first.  NOTE: this method will be considered
        EXTRA CREDIT and thus is optional but if done correctly will be
        worth 5 points of extra credit on this project.  The output of this
        function is NOT sorted by lexicographical order.

  xv. findEventsSameVenue - Prints for every event in the list, the title of
        events with the same venue other than itself (if any) according to
        the BNF entry <find_same_venue_succ> 
        If there are no events available in the list a message as specified
        by the BNF entry <find_same_venue_fail> must be generated.
        NOTE: this method will also be considered EXTRA CREDIT and
        thus is optional but if done correctly will be worth 5 points of extra
        credit on this project (meaning there are 10 possible extra credit
        points).
        The following is an sample output (not necessarily associated with 
        the primary input) for this command:

                Events with the same venue:
                Diving: Swimming, WaterPolo
                Equestrian: No other events with the same venue.
                Swimming: Diving, WaterPolo
                WaterPolo: Diving, Swimming

c. BNF
------     
  <add_succ> ::= "Event "<title>" added successfully."<endl><endl><endl> 
  <add_fail> ::= "Adding event "<title>" failed."<endl><endl><endl>

  <add_to_part_succ> ::= <name_out>" added successfully to the participants of "
                                   <title>"."<endl><endl><endl>
  <add_to_part_fail> ::= "Adding "<name_out>" to the participants of "
                                   <title>" failed."<endl><endl><endl> 

  <del_succ> ::= "Event "<title>" deleted successfully."<endl><endl><endl>
  <del_fail> ::= "Deleting event "<title>" failed."<endl><endl><endl>

  <del_from_part_succ> ::=
                 <name_out>" deleted successfully from the participants of "
                                    <title>"."<endl><endl><endl> 
  <del_from_part_fail> ::= "Deleting "<name_out>" from the participants of "
                                    <title>" failed."<endl><endl><endl>

  <print_forward_manager> ::= <print_forward><endl><endl>
  <print_backward_manager> ::= <print_backward><endl><endl>

  <find_event_succ> ::= "Event found."<endl><event_out><endl><endl>
  <find_event_fail> ::= "Event "<title>" not found."<endl><endl><endl>
  
  <find_events_of_succ> ::=
            "Events of "<name_out>":"<endl><titles_list><endl><endl>
  <titles_list> ::= <title><endl> | <title><endl><titles_list>
  <find_events_of_fail> ::=
            "Events of "<name_out>":"<endl>"No events found."<endl><endl><endl>

  <find_events_bet_year_succ> ::=
            "Events added between "<integer>" and "<integer>":"<endl>
                    <titles_list><endl><endl>
  <find_events_bet_year_fail> ::=
            "Events added between "<integer>" and "<integer>":"<endl>
                    "No events found."<endl><endl><endl>

  <find_venue_succ> ::= "The following events are held at "<venue>":"<endl>
                               <titles_list><endl><endl>
  <find_venue_fail> ::= "The following events are held at "<venue>":"<endl>
                               "No events found."<endl><endl><endl>   

<find_same_venue_succ> ::= "Events with the same venue:"<endl>
                                   <ven_list><endl><endl><endl>
            <ven_list> ::= <ven_entry><endl> | <ven_entry><endl><ven_list>
           <ven_entry> ::= <title>": "<title_list_ven> 
                           | <title>": No other events with the same venue."
      <title_list_ven> ::= <title_list_ven>", "<title> | <title>
<find_same_venue_fail> ::= "Events with the same duration:"<endl>
                                 "No events found."<endl><endl><endl> 

d. Additional Info 
------------------
  i. YOU CANNOT MODIFY THE posted DataManager.h file in any way.  YOU MUST USE
     THE EXACT DataManager.h file we have provided.

 ii. Notice that every command after completion generates two newlines.

iii. All the above methods have void as the return type.

 iv. findEventsOf must be implemented using an iterator.

  v. findEventsSameVenue must be implemented using iterators (otherwise
     you will receive no credit for that method implementation).

7) 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 following commands can appear as part of the input (the BNF for the
   commands follows): 

       i. ADDEVENT - adds an event to the system.
      ii. ADDTOPART - adds a name to the participants list of an event.
     iii. DELEVENT - deletes event from the system.
      iv. DELFROMPART - deletes a participant from an event.
       v. PRIEVENTSFORW - prints all the events in the list (forward).
      vi. PRIEVENTSBACK - prints all the events in the list (backward).
     vii. FINEVENT - finds information about an event.
    viii. FINEVENTSOF - finds all the events associated with a person.
      ix. FINEVENTSBETYEAR - finds the titles of events added to the olympics
                             between two specified years, inclusive.
       x. FINVENUESCHED - finds the titles of all events being held at a
                          specific venue and lists them in the order they
                          occur at that venue.
      xi. FINEVENTSVENUE - finds for each event the titles of events with
                           the same venue.
     xii. QUIT - ends the program.

c. BNF  
      <commands> ::= <command> | <command><commands>
       <command> ::= <maybews><actual_command>
<actual_command> ::= <add_com> | <del_com> | <print_com> | <find_com> 
                     | <quit_com> 
       <add_com> ::= "ADDEVENT"<ws><event_in> |
                     "ADDTOPART"<ws><name_in><ws><title><ws>
       <del_com> ::= "DELEVENT"<ws><title><ws> |
                     "DELFROMPART"<ws><name_in><ws><title><ws>
     <print_com> ::= "PRIEVENTSFORW"<ws> | "PRIEVENTSBACK"<ws>
      <find_com> ::= "FINEVENT"<ws><title><ws> |
                     "FINEVENTSOF"<ws><name_in><ws> |
                     "FINEVENTSBETYEAR"<ws><year><ws><year><ws> |
                     "FINVENUESCHED"<ws><venue><ws> |
                     "FINEVENTSVENUE"<ws>
      <quit_com> ::= "QUIT"<maybews>
 
d. The format of the outputs for the above commands are as specified in the 
   DataManager class.

e. The files primary.input and primary.output in the posting account show
   examples of some of the commands and the expected outputs.

8) 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. The EventList class MUST IMPLEMENT A DOUBLY-LINKED LIST OTHERWISE YOU WILL RECEIVE A GRADE OF 0 FOR THIS PROJECT EVEN IF YOUR PROJECT GENERATES THE PRIMARY OUTPUT.
  3. 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.
  4. 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.
  5. 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).
  6. YOU MUST USE THE main.cpp FILE WE HAVE PROVIDED.
  7. YOU CANNOT USE TEMPLATES, INHERITANCE, NOR THE STL (Standard Template Library) IN ORDER TO IMPLEMENT THIS PROJECT.
  8. You can NOT use files or any type of fstreams in this project.
  9. 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.
  10. 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. This project could be considered a long one. You must start working on it immediately. 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 implementing the "supporting" classes (Name, NameList, Event) before you move on to the linked-list implementation.
  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 p1 and that typing make p1 or just make will result in the necessary files being compiled to create the executable p1 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.

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  p1
%  p1  < primary.input  > my.output
%  diff  -bwi  primary.output  my.output
%

The first line (make p1) 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 (p1 < prima...) is a way to run the p1 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/P1/ directory, there are the following files (and possibly others):

     main.cpp        Event.h         Name.h
     DataManager.h   EventList.h     NameList.h
You must use these files when creating your project and you may not create any other files for this project 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).

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

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

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  EventList.h     Name.cpp        NameList.cpp
     Event.h          EventList.cpp   main.cpp        makefile
You must do this using the tar command similar to how it was used in project #0 - 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 p1 and it must contain all those text files (.cpp, .h and makefile) necessary to create p1.

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  proj1.tar  1
at the UNIX prompt and that will run the submit program and attempt to turn in the file proj1.tar from the current directory for project #1.

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: Fri Sep 10 12:35:09 EDT 2004
left up down right home