Assignment #4, COP-3337

This assignment is due on Tuesday, February 11 at the start of class. Absolutely no late submissions will be accepted.

Basic Assignment

You are to design the class interface for a new class named Integer. The Integer class should allow all standard operations to be performed with arbitrarily large integers. In other words, unlike the standard int which may range from -2147483648 to 2147483647, and will overflow silently, your Integer will internally store as many digits as needed (in an array). Note however, that you do not have to actually implement anything. You must simply provide a class interface. (Actually, as described below, you will provide two interfaces representing alternate designs).

Operations That Must Be Supported

Your Integer must specify the following:

Implementations

You must provide interfaces for two separate implementations.

Implementation #1

The internal data for the Integer consists of a Vector<int> that stores the digits, an int that tells whether the stored value is positive or negative, and an int that tells how many digits are logically stored (not counting leading zeros). It may help to remember that the copy constructor is disabled in the current Vector implementation, but operator= is not. Since an implementation is not required, you do not need to know anything else.

Implementation #2

The internal data for the Integer is identical to implementation #1 except that the Vector<int> is replaced by an int* object that represents a dynamically allocated array and an int that represents the maximum number of digits that the array can store.

Important Decisions

As you write the interface, make sure you carefully decide: Also, be sure to comment judiciously, use appropriate white space, and make sure that your code is easy to read.

What To Submit

Place the interfaces for each of the Integer implementations described above in separate header files Integer1.h and Integer2.h. Remember to use the #ifndef trick. You can check for syntax errors by writing a main.cpp program that includes the header file, and attempts to compile. Of course, without an implementation, you can only test for trivial things such as missing braces, parentheses, semicolons. However, any syntax errors that are found in the course of grading the program will require deductions. Submit both Integer1.h and Integer2.h. Since there is no implementation, there is no output.