BigInt

Write a Java class, BigInt, that uses an array of integers to store the digits of a non-negative decimal integer up to fifty digits long.  Assume for this problem that the computer is limited to arithmetic operations on only a single digit at a time. So it can add 3 + 5 to get 8, but can not add 13 + 6. If asked to add 7 + 8 it would give 5 and a "carry" flag would be set.

The class contains the following methods

1.  A method which creates a BigInt with a value of zero.

2.  A method which creates a BigInt from a string passed to it. The string should not have to contain leading zeroes, so if the input is the number three hundred seventy-two the string could be "372" not "0000000372".

3. A method that computes the sum of two BigInt is, adds one to another and returns a BigInt as the result.

4. A method that converts the BigInt to a string.

5. A boolean method that compares this BigInt to another one for equality.

Implementation hint: Two BigInt are added by looping through the array (starting with the rightmost subscript) and adding together the digits in corresponding elements of the arrays. Use a boolean variable Carry to indicate whether or not the sum of the previous addition was greater than 9.


Write a test driver to interact with the user to obtain the numbers to be added. Read two strings of characters which represent decimal numbers of up to fifty digits each, add these numbers together, and display the result.

Test Data: Make sure your program runs correctly with at least these three test cases:

        Num1 = 1487625    
        Num2 =   12783    

        Num1 = 60705202
        Num2 = 30760832

        Num1 = 1234567890
        Num2 = 9876543210