CS12, Extra Credit Program

Assigned: May 25th, 2001

Due: June 6th, 2001, 10pm

 

This is an extra credit program. Depending on the work you put into it, it could be worth up to an entire letter grade. This is your opportunity to make up points lost on earlier assignments or on the tests.

 

Topics

 

Background

The array type in C++ is rather rudimentary. Among other problems, it does not protect the user from exceeding the array bounds; indexing of array elements must start at 0; arrays cannot be assigned to each other directly with an assignment statement; the contents of an entire array cannot be printed out with one cout statement. In this assignment, you will create a template for an array class that addresses these issues.

To do

Write a class template for an enhanced array class that will expand the capabilities of C++ arrays to include the following:

Implementation of your class is entirely up to you. You may use one- or two-dimensional arrays, linked lists, or any other implementation that you come up with. Consider your design carefully before you start coding. Explain clearly what you are doing and how. Document everything in a separate file that will be handed in with your program.

After you have written your class, you will need to test it. Write a test main() that illustrates the use of each of the methods of your class at least once, to make sure that all the features work correctly.

What to turn in

 

Extra Credit

You may add as many features as you want to your Array class. There are many bells and whistles that could be added to such a class to enhance its usability. The more you do, the more points you can earn.

However, please keep in mind the following points:

  1. If it’s not documented, it isn’t there
  2. If it’s not tested in the main, it isn’t there