CSCI 1730                    Programming Project 6B                  Summer 2009

                    Class of sets of natural numbers, Part B


This program is due by midnight on *** Thursday, July 23. ***

In this assignment you will modify your class Nset from Part A to build a
class NSet, in which some of the member functions are replaced by overloaded
operators, and a few new features are introduced.  Much of the description of
Project 6A applies to 6B by just changing the names of the class and it's
header and implementation files.  Here we only describe the aspects of Project
6B which differ from those of Project 6A.

Your project submission should include a header file numset.h, an
implementation file numset.cc, a driver file proj6Btest.cc, a Makefile
and a READ_ME file.  Your Makefile should allow for separate compilation of
object files numset.o and proj6Btest.o, along with linking the two object
files to produce an executable file proj6Btest.

The new or modified public functions, with their behaviors, follow.  Each
may be a member function of NSet or a global friend function, as appropriate.

Constructors and Destructor  --  no change from Part A.

Accessors: overload the stream insertion operator << so as to accept an object
    of type NSet and insert/display the elements of the set in increasing order,
    8 to a line.  In case the set is empty, insert/display the string
    "(empty NSet)".
  Retain the accessors of Part A except that has( ) should be replaced by
    overloading [ ].
  
Comparators: overload <=, >=, and == to replace subset( ), superset( ), and
    equals( ), respectively.

Mutators: supply a conversion operator from Nset to NSet, an overloaded
    = operator (assignment operator), and an ovrloaded stream extraction
    operator >>.  The latter should convert any sequence of natural numbers
    separated by whitespace into an NSet.
  In addition, each of the mutators from Part A should be replaced by an
      overloaded operator, as follows:
    addelt( ) becomes |=;
    delelt( ) becomes -=;
    Union ( ) becomes |=;
    intersect ( ) becomes &=;
    minus ( ) becomes -=;
    delta ( ) becomes ^=, and is also overloaded so that executing "A ^= n"
      for an NSet A and a nonnegative integer n toggles the membership of n
      in A (nonmember to member and vice versa);
    add ( ) becomes +=, for both versions of add( );
    mul ( ) becomes *=, for both versions of mul( ).

Note:

  *Since an overloaded assignment operator for NSet will be supplied, your
   code can pass and return NSet objects by value as well as by reference.