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

Hi there! I have a programming assignment, to be written in Java, and I have no

ID: 667932 • Letter: H

Question

Hi there! I have a programming assignment, to be written in Java, and I have no clue where to begin. I am not asking for the full code, but just need direction in where to begin and hints on how to handle the methods. Thanks! Below is the assignment.

Integer types are very convenient, but their limited width makes them unsuitable for some applica-
tions where precise large values are more important than speed. Develop a class VeryLargeInteger
that can handle arbitrary long integer numbers (both negative and positive) and the basic arith-
metic operations (addition, subtraction, multiplication, division, and remainder).

Hint: The number could be represented as string, the sign could be represented either as boolean
or as part of the string.

Note: Implementations of addition/subtraction through repeated use of a constant incremen-
t/decrement will not be accepted. Implementations of multiplication and division that rely on
stepwise addition or subtraction will not be accepted.

Explanation / Answer

we can use big integer for this.

java implementation will be

import java.math.BigInteger;

public class BigIntegerDemo {

public static void main(String[] args) {
  
BigInteger b1 = new BigInteger("987654321987654321000000000");
BigInteger b2 = new BigInteger("987654321987654321000000000");
  
BigInteger product = b1.multiply(b2);
BigInteger division = b1.divide(b2);
       BigInteger add = b1.add(b2);
       BigInteger sub = b1.subtract(b2);
  
System.out.println("product = " + product);
System.out.println("division = " + division);
       System.out.println("addition = " + addition);
       System.out.println("subtraction = " + sub);
  
}
}

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