Question
I was asked to implement an ADT that will replicate some of the capabilities of Javas BigInteger class. Belove is what I achieved so far,
I was asked to implement an ADT that will replicate some of the capabilities of Javas BigInteger class. Belove is what I achieved so far, and i have no idea have to write the add() method, as well as the rest.
import java.math.BigInteger;
import java.util.ArrayList;
// Your class should behave as Java's BigInteger class does. The majority of
// the methods can be studied using Java's documentation.
public class MyBigInt {
private int bigInt;
long value;
String str;
public MyBigInt (){
}
public MyBigInt(long value){
this.value = value;
}
public MyBigInt(String str){
bigInt = Integer.parseInt(str);
}
public String toString() {
return String.format("%s;%s", value, str);
}
public MyBigInt add(MyBigInt other){
}
public MyBigInt subtract(MyBigInt other){
}
public MyBigInt negate(){
}
public int compareTo(MyBigInt other)
public MyBigInt max(MyBigInt other)
public MyBigInt min(MyBigInt other)
public int signum(){
}
public static MyBigInt valueOf(long value){
return new MyBigInt(value);
}
}
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started