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

Can someone help me write a .addToList(); method and .getNumber(i); method or is

ID: 3677741 • Letter: C

Question

Can someone help me write a .addToList(); method and .getNumber(i); method or is the way i wrote it ok to use other.digit[i].

BigInt answer = new BigInt("0");
       for(int i =0;i<other.digit.length;i++)
       {
           BigInt answer2 = new BigInt();
           for(int k=0;k<i;k++)
           {
               answer2.addToList(0);
           }
           for(int j=0;j<this.digit.length;j++)
           {
               answer2.addToList(other.digit[i]*this.digit[j]);
           }
           answer2.multi();
           answer=answer.add(answer2);
       }

Explanation / Answer

public class BigInt{
private ArrayList<BigInt> bigINtlist = new ArrayList<BigInt>();
private private int[] digits;
public BigInt(String s) {
       digits = new int[s.length()];
       for (int i=0; i<digits.length; i++)
           digits[i] = (s.charAt(digits.length-1-i)-'0');
   }

public ArrayList<BigInt> addToList(BigInt obj) {
      
       bigINtlist.add(obj);
      
      
   }

}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote