School of Engineering and Applied Science
Department of Computer Science
CSci 133 -- Algorithms and Data Structures I
http://www.seas.gwu.edu/~csci133/fall04
Prof. Michael B. Feldman
mfeldman@gwu.edu

Project #2

Due Dates: Stage 1: beginning of class, Tuesday, Sept. 28, 2004
Stage 2: beginning of class, Tuesday, October 5, 2004

Requirements:

This project is an exercise in enhancing a reusable component by adding useful new methods. In this 2-stage project you will add a few new methods to the ArrayBag class presented in Lewis/Chase, Chapter 2.

Stage 1:

  1. Copy the file programs133/jss2/ArrayBag.java into your csci133/jss2 subdirectory. You may already have done this in lab.
  2. In the line public class ArrayBag implements BagADT, delete the words implements BagADT, and also change all occurrences of BagADT to ArrayBag.
  3. Add stubs, including javadoc-compatible comments, to this file for these new methods:
    public ArrayBag difference (ArrayBag bag)
    -- returns a new bag that contains just those members of the current bag that are not present in bag;
    public ArrayBag intersection (ArrayBag bag)
    -- returns a new bag that contains all elements that are present in both the current bag and bag.
  4. Compile ArrayBag.java to make sure it is free of compilation errors.
  5. Copy the modified ArrayBag.java to your website and invoke javadoc to produce javadoc pages.
  6. Develop and test plans for the two new methods.

Stage 2:

Implement and test the modified class.

What to submit:

With this project, the deliverables change from the CSci 53 style, because you are developing a reusable class, instead of just an application as in Project 1. You'll need to submit the required test plans, and one or more test programs that implement(s) the test plan(s). You need not develop completely separate test programs, but can use successive versions of the same test program. This is up to you.