Jey G.

asked • 05/24/21

please help me with this java design for data structures the language is java

Problem. Design a data structure to support operations on positive integers with many digits.

The data type int in Java has a limited range from -2³¹ = -2147483648 to 2³¹ - 1 = 2147483647, about 2.1 billion. 

The data type long has a larger limited range from -2⁶³ = -9223372036854775808 to 2⁶³ - 1 = 9223372036854775807, about 9.2 quintillion.

The purpose of this final is to design a class to support some arithmetic operations on positive integers with many digits. The operations are addition, subtraction, multiplication and exponentiation. For simplicity for the

subtraction of two big positive integers a and b, a - b, assume a ≥ b and for exponentiation of aⁿ, assume n is a positive int.

Your abstract data type for big positive integers must use the ArrayList< E > class found in the java.util package. You cannot use the BigInteger class of the java.math package. 

Your design is a detailed essay that uses proper English in which you describe the development of your class to support some arithmetic operations on big positive integers with many digits. Your essay must describe in detail the development of a class for big positive integers, called BigPositiveInt. It must also describe the class called Main that contains the required method main() with statements to test the methods of the class BigPositiveInt.

For the class BigPositiveInt you must describe in detail its attributes, its constructors and its methods. You must describe in detail the algorithm for each constructor and for each method of the class with English paragraphs. Then you must provide pseudo code for your algorithm. You must include a simulation of each algorithm for an arithmetic operation with small arguments and a base of 10.

I suggest using the usual algorithms for binary operations for addition, subtraction and multiplication from grade school. Later in this document, a refresher for addition occurs. I also suggest that you design methods 

for the class BigPositiveInt in the following order: 

           constructors, toString(), add, multiply and subtract.


1 Expert Answer

By:

Patrick B. answered • 05/31/21

Tutor
4.7 (31)

Math and computer tutor/teacher

Still looking for help? Get the right answer, fast.

Ask a question for free

Get a free answer to a quick problem.
Most questions answered within 4 hours.

OR

Find an Online Tutor Now

Choose an expert and meet online. No packages or subscriptions, pay only for the time you need.