CS 1030 Spring 2008,    Homework 9       Due:  Thursday April 3

A paper copy of your program should be turned in at the beginning of class.
Your work should be dropped off electronically in the Lamont folders by 10:00 AM on the due date.
Late Deadline:  turn in by Midnight Friday April 4 for a 10% penalty.  (Paper on my office door.)
For further details on how to hand in assignments, see these Submission Guidelines.

Create a Set class that keeps its elements (strings) in a linked list.  Your Set class should support all
the operations used in the code below.  (Paste the code given below into your main to test your class.)
Create additional Set methods and classes if needed. All data members should be private and the
only allowed friend classes are a list and its node.  Recall that the order of the elements in a set is not
important, but no element should appear more than once.  Also two sets are equivalent if each is a
subset of the other.

Set prez;
Set vp;

prez.insert("LBJ");
prez.insert("Bush Jr.");
prez.insert("Clinton");
prez.insert("Bush Sr.");

if (prez.includes("LBJ"))
    cout << "LBJ was a prez." << endl;
else
    cout << "LBJ was not a prez." << endl;

vp.insert("Bush Sr.");
vp.insert("Gore");
vp.insert("Cheney");
vp.insert("LBJ");
vp.insert("Gore");  // trick!  this should not result in 2 Gore's

vp.display();  // the order of the elements doesn't matter

Set uni = prez.union(vp);
uni.display();     // should see all the people, no repetitions

Set inter = prez.intersect(vp);
inter.display();    // should see only the intersection

Set bushes;
bushes.insert("Bush Jr.");
bushes.insert("Bush Sr.");

if (bushes.subsetOf(prez))
    cout << "bushes is a subset" << endl;
else
    cout << "bushes is not a subset" << endl;

Set uni2 = vp.union(prez);

if (uni.equivalentTo(uni2))
    cout << "two unions are the same" << endl;
else
    cout << "two unions are not the same" << endl;