Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

IN JAVA PLEASE Program 1: BigNumber class In languages such as CH and Java, the primitive data type int is limited to a 32 bit

IN JAVA PLEASE
image text in transcribed
Program 1: BigNumber class In languages such as CH and Java, the primitive data type int is limited to a 32 bit or 64 bit representation. Construct a class, BigNumber, to represent very large integers - integers greater than 2,147,483,647. Write the necessary class methods allowing the addition of any two BigNumber objects. Assume only addition will be performed on this class of numbers. Write a test application that prompts the user for two BigNumber data elements and add them together. Test Execution 1: x.add(y); should produce Test Execution 2: y = 21 X.add(y); should produce Test Execution 3: x = 19 y = 765521 x.add(y); should produce 765540 Suggestions: 1. Treat each big number as a String containing a collection of digits. 2. Add the BigNumbers digit by digit, adding a carry value when necessary. For example, the big numbers 778321 and 100000 are stored as strings. But, when summing the two, an ArrayList of Integers can be used to compute independent digits. big[0= 1 big[1] = 2 big/21 - 3 big31= 8 big[4] = 7 big 51 - 8

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Intelligent Databases Object Oriented Deductive Hypermedia Technologies

Authors: Kamran Parsaye, Mark Chignell, Setrag Khoshafian, Harry Wong

1st Edition

0471503452, 978-0471503453

More Books

Students also viewed these Databases questions