Download Object-Oriented Programming Assignment 3: HugeInt Class in Java and more Assignments Computer Science in PDF only on Docsity! COP 3330 – Object-Oriented Programming Spring 2002 Program Assignment 3 Assigned: 2/22/02 Due: 3/6/02 (Arup's section), 3/7/02 (Dr. Cicekli's section) In this assignment, you will write a Java program containing two classes. The first class is HugeInt class to represent huge integer numbers, and the second class is HugeIntTest class to test the methods in your HugeInt class. The class HugeInt should store values as an array of digits, i.e. each decimal digit (0-9) in the value should be placed into one element of the array. For instance, the value 12345678901234567890123456789 can be stored as 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 You will also need another field to represent the sign of this huge integer number. So, the fields of your HugeInt class should be: private int[] hugeintnum; // array to hold digits of the huge integer private boolean positive; // if this field is true, the number is positive (or zero); // otherwise the number is negative. Your HugeInt class should contain the following methods: // Constructors // Creates a huge integer corresponding to zero. public HugeInt() // Creates a huge integer corresponding to the given string. The given string holds the digits of the huge number. // The first character of this string can be +, - or a decimal digit, and its other characters are decimal digits. public HugeInt(String s) // Creates a huge number corresponding to the given long value. // The given long value can be positive or negative. public HugeInt(long n) // Instance method - isEqual // This method should compare the huge number in the current object with the huge number (or the long value) // which is given as a parameter. If they are equal, it should return true; otherwise it should return false. public boolean isEqual(HugeInt hugenum2) public boolean isEqual(long num2) // Instance method - add // This method should add the huge number in the current object with the huge number (or the long value) // which is given as a parameter, and it should return the result in the another HugeInt object. public HugeInt add(HugeInt hugenum2) public HugeInt add(long num2)