CMPU-235: Software Development Methodology
Homework #1
Due: Feb 3
A bag is a container class that has the following
properties:
- There is no implicit order to the elements in the bag.
- A single iteration across the elements of the bag will visit each
element once and only once.
- Each iteration is likely to visit the elements in a different
order.
Note that iteration across the elements of a bag does not remove the
elements from the bag.
For this homework:
- Design and implement a bag class that will keep strings of length
20 or less.
- Design and implement a bag class that will keep integers.
- 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.