Data Structures and Algorithms with Object-Oriented Design Patterns in C#
next up previous contents index

Projects

  1.   Design and implement suitable wrapper classes that extend the ComparableObject base class for the C# types bool, byte, short, long, float, and void.
  2. Using visitors, devise an implementation for the IsMember property and the Find method of the AbstractSearchableContainer class declared in Program gif.
  3. Using an enumerator, devise an implementation for the IsMember property and the Find method of the AbstractSearchableContainer class declared in Program gif.
  4. Devise a scheme using visitors whereby all of the objects contained in one searchable container can be removed from it and transfered to another container.
  5.   A bag  is a simple container that can hold a collection of objects. Design and implement a concrete class called Bag that extends the AbstractSearchableContainer class defined in Program gif. Use the DynamicArray class given in Chapter gif to keep track of the contents of the bag.
  6. Repeat Project gif, this time using the LinkedList class given in Chapter gif.
  7. In Java it is common to use an enumeration  as the means to iterate through the objects in a container. In C# we can define an enumeration like this:
    public interface Enumeration
    {
        bool hasMoreElements { get; }
        object nextElement();
    }
    Given an enumeration e from some container c, the contents of c can be printed like this:
    while (e.hasMoreElements)
        Console.WriteLine(e.nextElement());
    Devise a wrapper class to encapsulate a C# enumerator and provide the functionality of a Java enumeration.


next up previous contents index

Bruno Copyright © 2001 by Bruno R. Preiss, P.Eng. All rights reserved.