Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

finish the java program a. Begin by creating a standard list ADT in a new class

ID: 3787519 • Letter: F

Question

finish the java program

a. Begin by creating a standard list ADT in a new class called MyIntList. The underlying data

structure is to be an int array with a maximum size of 200 elements. Also implement the

following methods to provide an interface to your list ADT:

• int size() - which returns the number of elements in the list

• int get(int index) – which return the integer element at the specified zero-based index

• void set(int index, int value) – which sets the list element at index with the given value

b. Next, create a class called MyHugeInteger that is to represent an integer up to 200 digits

long. This class must provide a constructor that takes a single String as an argument. The

String value passed to the constructor is understood to be a string of digits representing a

large integer. You can assume that the value passed to the constructor is well formatted; it

contains no spaces or non-numeric characters other than the first character possibly being a

“-” if the large number is negative. Inside your class, represent the large integer as a list of

digits using the MyIntList you created in the previous section. In addition to these

requirements, provide the following interface methods:

int compareTo(MyHugeInteger hugeInt) – where the return value is -1 if hugeInt is less

than the object's large integer value, +1 if hugeInt is greater or 0 if the two values are

equal

String toString() - which returns a String of all the digits that make-up the huge integer,

including a negative sign if the large integer is negative. When printed to screen, the

String should read a normal, though large, integer.

c. Create a new class called MyHugeIntegerTools that provides the following methods which

operate on lists of MyHugeInteger (no constructor is necessary for this class):

MyHugeInteger getMin(Vector<MyHugeInteger> hugeIntList) – this method is to return

the MyHugeInteger with the smallest value in the given list

MyHugeInteger getMax(Vector<MyHugeInteger> hugeIntList) – this method is to return

the MyHugeInteger with the largest value in the given list

Vector<MyHugeInteger> getDuplicates(Vector<MyHugeInteger> hugeIntList) – this

method is to return a Vector of MyHugeInteger that appear more than once in the given

list

void sortAscending(Vector<MyHugeInteger> hugeIntList) – this method is to sort the

contents of the given list into ascending order. That is, when the sorting is complete, the

smallest value is at index 0, the largest is at the end index and all values in between are

sorted in increasing order. Note how there is no return value. This is because the sort is

to be done in-place. Since the given list is to be modified directly, there is no need to

copy it. You may implement the sorting algorithm of your choice from the ones

presented in Chapter 3 of the course textbook (i.e. Bubble, Selection or Insertion).

Explanation / Answer

/** * @fileName :MyIntList.java * @author ravi * @since 06-02-2017 **/ package largenumber; public class MyIntList { int number[] = new int[200]; static int count; /** * This method will return size of list * @return: int:size of list */ int size(){ return count; } /** * This method returns the element at given index * @param index:int * @return: int :element at given index */ int get(int index){ return this.number[index]; } /** * This methos set the value at given index * @param index:int * @param value:int */ void set(int index,int value){ this.number[index]=value; count++; } } /** * @fileName :MyHugeInteger.java * @author * @since 06-02-2017 **/ package largenumber; public class MyHugeInteger{ MyIntList value; String str; /** * This is parametrized Constructor * @param value:String */ public MyHugeInteger(String value) { this.value =new MyIntList(); for(int i=0;i