subject

Create a class HugeInteger which uses a vector of digits to store huge integers. A HugeInteger object has a sign that indicates if the represented integer is non-negative (0) or negative (1). Provide methods parse, toString, add and subtract. Method parse should receive a String, extract each digit using method charAt and place the integer equivalent of each digit into the integer vector. For comparing HugeInteger objects, provide the following methods: isEqualTo, isNotEqualTo, is Greater Than, isLessThan, is GreaterThanOrEqualTo, and LessThanOrEqualTo. Each of these is a predicate method that returns true if the relationship holds between the two HugeInteger objects and returns false if the relationship does not hold. Provide a rpedicate method isZero. If you feel ambitious, also provide methods multiply, divide and remainder. [Note: Primitive boolean values can be output as the word ❝true❝ or the word ❝false❝ with format specifier %b.]
public class HugeInteger
{
private int[] intArray;
private int numDigits; // stores the number of digits in intArray
public HugeInteger(String s)
{
intArray = new int[40];
numDigits = 0;
// call parse(s)
}
public HugeInteger( )
{
intArray = new int[40];
numDigits = 0;
}
public void parse(String s)
{
// Add each digit to the arrays
// update numDigits
}
public static HugeInteger add(HugeInteger hugeInt1, HugeInteger hugeInt2)
{
// Create hugeInt3
// Loop
// Add digits from hugeInt1 and hugeInt2,
// Store in corresponding hugeInt3
// End
//
// return hugeInt3
}
public static HugeInteger subtract(HugeInteger hugeInt1, HugeInteger hugeInt2)
{
// Create hugeInt3
// Loop
// Subtract hugeInt2 digit from hugeInt1,
// Store in corresponding hugeInt3
// End
//
// return hugeInt3
}
public static boolean isEqualTo(HugeInteger hugeInt1, HugeInteger hugeInt2)
{
// return true if the value represented by
// elements of hugeInt1.intArray is equal to
// value represented by elements of hughInt2.intArray
}
public static boolean isNotEqualTo(HugeInteger hugeInt1, HugeInteger hugeInt2)
{
// return true if the value represented by
// elements of hugeInt1.intArray is not equal to
// value represented by elements of hughInt2.intArray
}
public static boolean isGreaterThan(HugeInteger hugeInt1, HugeInteger hugeInt2)
{
// return true if the value represented by
// elements of hugeInt1.intArray is greater than
// value represented by elements of hughInt2.intArray
}
public static boolean isLessThan(HugeInteger hugeInt1, HugeInteger hugeInt2)
{
// return true if the value represented by
// elements of hugeInt1.intArray is less than
// value represented by elements of hughInt2.intArray
}
public static boolean isGreaterThanOrEqualTo(HugeInteger hugeInt1, HugeInteger hugeInt2)
{
// return true if the value represented by
// elements of hugeInt1.intArray is greater than or equal to
// value represented by elements of hughInt2.intArray
}
public static boolean isZero(HugeInteger hugeInt1 )
{
// return true if the value represented by
// elements of hugeInt1.intArray is 0
}
public String toString( )
{
// return string representation of this object
}
}

ansver
Answers: 2

Another question on Computers and Technology

question
Computers and Technology, 21.06.2019 18:30
Ineed on my history if anyone can check out the last few questions i posted and i will be posting !
Answers: 2
question
Computers and Technology, 23.06.2019 15:00
What is the total resistance in a circuit that contains three 60 ohm resistors connected in a series? a. 20 ohms b. 120 ohms c. 60 ohms d. 180 ohms
Answers: 2
question
Computers and Technology, 23.06.2019 18:30
Write a program that prints the day number of the year, given the date in the form month-day-year. for example, if the input is 1-1-2006, the day number is 1; if the input is 12-25-2006, the day number is 359. the program should check for a leap year. a year is a leap year if it is divisible by 4, but not divisible by 100. for example, 1992 and 2008 are divisible by 4, but not by 100. a year that is divisible by 100 is a leap year if it is also divisible by 400. for example, 1600 and 2000 are divisible by 400. however, 1800 is not a leap year because 1800 is not divisible by 400.
Answers: 3
question
Computers and Technology, 24.06.2019 02:10
Aspeed limit sign that says "night" indicates the legal speed between sunset and sunrise.
Answers: 2
You know the right answer?
Create a class HugeInteger which uses a vector of digits to store huge integers. A HugeInteger objec...
Questions
question
English, 24.02.2021 18:50
question
Mathematics, 24.02.2021 18:50
question
Mathematics, 24.02.2021 18:50
Questions on the website: 13722367