CS320 - OBJECT ORIENTED SOFTWARE DEVELOPMENT WITH C++

The Project - Due: Wednesday, October 13, at the start of class

    For this project, you will be working with a partially-complete 
implementation of the video rental store software system that you have been 
working on in several of the homework sets.  This implementation fulfills all 
of the functional requirements EXCEPT those pertaining to managing reservations 
for items not currently in stock.  (However, a few "hooks" have been built into
the code to allow adding these functions easily).

   Your mission - whether or not you decide to accept it * - is to do the
following:

(1) THOROUGHLY UNDERSTAND the system as it now stands - except that you are 
    NOT responsible for understanding the details of how the persistent classes,
    iterators, and IO manipulators work.

(2) Add the reservations management functionality to the system.

* If you don't get this touch of humor, go to your favorite (real) video store 
  and rent "Mission Impossible" :-) .

    Note that this project is to be done in the same teams you have been 
working in for homework assignments.

Specific Directions:
-------- ----------

1. Go to the Video Store Project link from the course page. What you will
   see is simply a list of source files (.h file and corresponding .cc file)
   for the project.  Note that three file pairs (date.h/.cc, money.h/cc, and
   persistent.h/.cc) are omitted from this site.  (If you want to see these, 
   you may request a copy from the professor; however, mastery of them is not 
   required for the purposes of the project.)

   Thoroughly study these files.  A good starting point is store.cc - trace
   how each of the use cases is implemented by tracing through the operation
   of the appropriate section of the case statement in the runStore() method,
   along with the various other methods this code calls.

   You may also find it helpful to run the program yourself and see how
   it behaves.  An executable version can be accessed by

        $ RUN CS320:DEMO_PROJECT

2. Meet - as a team - with the professor.  You will be given an oral 
   examination on the above, which your team must pass before you can proceed
   to the next phase.

3. When your team has passed the oral examination, you will be given electronic
   copies of the following files:

   a. Header files:

        copy.h          customer.h              date.h          latecharge.h
        money.h         persistent.h            rentable.h      reservation.h
        store.h         yesno.h

   b. Compiled version of the partial system

        main.obj  (contains compiled copy.cc, customer.cc, latecharge.cc,
                   rentable.cc, reservation.cc, store.cc, date.cc, 
                   persistent.cc, and yesno.cc)

      Note that various methods (19 in all) have not yet been implemented and
      are missing from both the source code and main.obj.

   c. Compiled versions of code written by professor for routines you need to
      write - can be used to allow individual testing of routines you need to
      write

        prof.olb

   d. Skeleton file for code that you need to write:

        project.cc

4. The code you write should all ultimately go into project.cc.  Note that this 
   file will compile as it stands, and (when linked with the other files) will
   produce a functional system that has all needed capabilities except those
   pertaining to reservations.

   The complete program can be built by the following commands:

        gcc/plus project.cc
        link project, main, libgxx/opt

5. To test individual routines (or groups of routines) as you write them, 
   comment out the stubs for the routines you have not yet written, and
   include prof/lib on the link command line - e.g.
   
        link project, main, prof/lib, libgxx/opt

   The linker will automatically extract the professor's fully-functional 
   version of any routine not included in your code from prof.olb.

   Note that prof.olb is not needed when you have written everything, and
   that code will NOT be taken from it if a routine of the same signature
   exists in the code you have written (which is why you need to comment
   out the stubs for the routines you have not yet written.)

6. At the conclusion of the project (within 24 hours of the due date), each
   member of the team must send an email to the profesor indicating his/her
   appraisal of how much effort each member of their team (including 
   him/herself) contributed to the overall project the team submitted.

7. Operation description forms for the routines you need to write are
   attached

                        Copy::putOnHoldFor(Customer *)

Prototype:      void putOnHoldFor(Customer * customerOnHoldFor)

Purpose:        record that this copy is on hold for a particular customer
                 
Receives:       customerOnHoldFor - customer copy is to be placed on hold for

Returns:

Remarks:
--------------------------------------------------------------------------------

                        Copy::takeOffHold()

Prototype:      void takeOffHold()

Purpose:        cancel record that this copy is on hold

Receives:

Returns:

Remarks:        if rentable item that this copy belongs to has a pending
                 reservation, then this copy is used to satisfy it; else it
                 is placed on the shelf.  In the latter case, the field
                 recording the customer checked out to is set to NULL.
--------------------------------------------------------------------------------

                        Copy::customerOnHoldFor() const

Prototype:      Customer * customerOnHoldFor() const

Purpose:        Accessor for customer copy is currently on hold for, if any

Receives:

Returns:        If the copy is currently on hold, then the customer the copy
                 is on hold for, else NULL

Remarks:
--------------------------------------------------------------------------------
  
                        Customer::addReservation(Reservation *)

Prototype:      bool addReservation(Reservation * reservation)

Purpose:        Record that customer has a particular reservation

Receives:       reservation - entry that is to be added to customer's list
                 of reservations
                 
Returns:        true if reservation successfully added, else false

Remarks:        A check is made to see if customer already has a reservation
                 for the same item, or if customer has a copy of that item
                 already on hold.  If either of these holds, an appropriate
                 message is printed and the reservation is not added.

                        Customer::removeReservationFor(RentableItem *)

Prototype:      Reservation * removeReservationFor(RentableItem * item)

Purpose:        Remove reservation for a specific item from customer's list
                 of reservations
                 
Receives:       item - item that reservation to be removed is for

Returns:        reservation that was removed if successful, else NULL

Remarks:        Fails and returns NULL if customer does not have a reservation
                 for specified item.  Reservation is removed from customer's
                 list, but is not destroyed.     
--------------------------------------------------------------------------------

                        Customer::addCopyOnHold(Copy *)
   
Prototype:      void addCopyOnHold(Copy * copy)

Purpose:        Add copy to list of copies this customer currently has on hold

Receives:       copy - copy to be added to the list

Returns:

Remarks:
--------------------------------------------------------------------------------

                        Copy * Customer::removeCopyOnHold(Copy *)
  
Prototype:      void removeCopyOnHold(Copy * copy)

Purpose:        Remove copy from list of copies this customer has on hold

Receives:       copy - copy to be removed from the list

Returns:        copy that was removed if successful, else NULL

Remarks:        Fails and returns NULL if the copy is not on the list of
                 copies this customer has on hold.  Copy is removed from
                 the list, but is not destroyed.                 
--------------------------------------------------------------------------------

                        RentableItem::addReservation(Reservation *)

Prototype:      void addReservation(Reservation * reservation)

Purpose:        Add reservation to list of pending reservations for this item

Receives:       reservation - entry that is to be added to item's list
                 of reservations
                 
Returns:

Remarks:


                        RentableItem::removeTopPriorityReservation()

Prototype:      Reservation * removeTopPriorityReservation()

Purpose:        Remove next reservation to be satisfied from the list of
                 reservations for this item
                 
Receives:

Returns:        The first reservation on the list of reservations for this item,
                 or NULL if there is none
                 
Remarks:        The reservation is removed from the list, but is not destroyed
--------------------------------------------------------------------------------

                        RentableItem::removeReservationFor(Customer *)
  
Prototype:      Reservation * removeReservationFor(Customer * customer)

Purpose:        Remove reservation for a specific customer from item's list
                 of reservations
                 
Receives:       customer - customer that reservation to be removed is for

Returns:        reservation that was removed if successful, else NULL

Remarks:        Fails and returns NULL if item does not have a reservation
                 for specified customer.  Reservation is removed from item's
                 list, but is not destroyed.
--------------------------------------------------------------------------------

                        RentableItem::anyCurrentReservations()

Prototype:      bool RentableItem::anyCurrentReservations() const

Purpose:        report whether there are current reservations for this item

Receives:

Returns:        true if the list of reservations for this item is non-empty

Remarks:
--------------------------------------------------------------------------------

                        Reservation::Reservation(Customer *, RentableItem *)

Prototype:      Reservation(Customer * customer, RentableItem * item)

Purpose:        Constructor

Receives        customer - customer who made this reservation
                item - item this reservation is for
                
Returns:

Remarks:

                        Reservation::satisfyWith(Copy *)

Prototype:      void satisfyWith(Copy * copy)

Purpose:        Arrange to satisfy this reservation

Receives:       copy - the copy that is to be used to satisfy the reservation
                 (by being put on hold for the customer)
                 
Returns:

Remarks:        This reservation is removed from the list of pending 
                 reservations for the customer who made it.  The specified copy
                 is placed on hold for the customer and is added to the
                 customer's list of items on hold, and the clerk is notified
                 to inform the customer that the item reserved is now in.
--------------------------------------------------------------------------------

                        Reservation::print(ostream &) const
  
Prototype:      void print(ostream & stream) const

Purpose:        write a description of this reservation

Receives:       stream - stream to which the description is to be written

Returns:

Remarks:        Writes title of the item and name of the customer.
--------------------------------------------------------------------------------

                        Reservation::customer() const

Prototype:      Customer * Reservation::customer() const

Purpose:        Accessor for customer who made this reservation

Receives:

Returns:        Customer who made this reservation

Remarks:
--------------------------------------------------------------------------------

                        Reservation::item() const

Prototype:      RentableItem * Reservation::item() const

Purpose:        Accessor for item this reservation is for

Receives:

Returns:        Rentable item this reservation is for  

Remarks:


                        ostream & operator << (ostream, const Reservation & )

Prototype:      ostream & operator << (ostream & stream, 
                                       const Reservation & reservation)

Purpose:        ostream inserter for reservations

Receives:       stream - stream to which to print reservation
                reservation - reservation to be printed
                
Returns:        stream

Remarks:        This is an operator function, not a method.  
                Calls print method of Reservation.  
--------------------------------------------------------------------------------

                        Reservation::archive(PersistentStream &)

Prototype:      void archive(PersistentStream & stream)

Purpose:        Implements abstract archive method of base class 
                 PersistentObject for this subclass
                 
Receives:       stream - stream to/from which to archive the object

Returns:

Remarks:
--------------------------------------------------------------------------------

                        Reservation::archiveClass(PersistentStream &)

Prototype:      void archiveClass(PersistentStream & stream)

Purpose:        Implements static archiveClass method required for all
                 classes derived from PersistentObject
                 
Receives:       stream - stream to/from which to archive the object

Returns:

Remarks:

Copyright ©1999 - Russell C. Bjork