CMPU-235: Software Development Methodology

Homework #1

Due: Feb 3

A bag is a container class that has the following properties:

Note that iteration across the elements of a bag does not remove the elements from the bag.

For this homework:

  1. Design and implement a bag class that will keep strings of length 20 or less.
  2. Design and implement a bag class that will keep integers.
  3. Design and implement a bag class that will keep instances of the class person, defined as follows:
    class person {
      char firstName[20];
      char lastName[20];
      char ssno[10];
    }
    

For each of your bags, demonstrate that your class works with an example that shows at least two iterations across the contents.