It is sometimes desirable to be able to handle numbers of arbitrary size, without having to consider the limit of the machine representation or to rely on a utility library.

A linked list, implemented with pointers and dynamic memory allocation, is a natural solution: we obtain storage to hold digits only when necessary. Such an approach is called infinite precision arithmetic.

To represent a large number such as 15,000,701,800,029 with a linked list, we could simply create a node for each digit. However, to make more efficient use of memory, we store an integer between 0 and 999 in each node, which gives the effect of base 1, 000 numbers. For example, the number above can be represented by a five-node list (15, 0, 701, 800 and 29).

Your input should contain several pairs of large numbers. Your program should read and echo each pair of numbers, compute and report their sum and product, and go on to process the next pair until the end of input.

Put your solution in the form of a class named LargeNumbers, which uses the Node class to provide nodes for the linked list representation. There should be, among other things,

- a method to read/get the input from file/keyboard

- a method to put a large number into a linked list

- a method to add two large numbers

- a method to multiply two large numbers

- a method to output a large number

The main method must look like this pseudo-code:

While (not end of input)

{

Get/Read and echo a pair of numbers N1 and N2;

Output sum (N1, N2);

Output product (N1, N2);

}

So here’s a sample output:

LargeNumber1: 1 506 033 005 018 000 029

LargeNumber2: 1 992

Sum is: 1,506,033,005,018,002,021

Product is: 3,000,017,745,995,856,057,768

Test on a few pairs of large numbers.

A linked list, implemented with pointers and dynamic memory allocation, is a natural solution: we obtain storage to hold digits only when necessary. Such an approach is called infinite precision arithmetic.

To represent a large number such as 15,000,701,800,029 with a linked list, we could simply create a node for each digit. However, to make more efficient use of memory, we store an integer between 0 and 999 in each node, which gives the effect of base 1, 000 numbers. For example, the number above can be represented by a five-node list (15, 0, 701, 800 and 29).

Your input should contain several pairs of large numbers. Your program should read and echo each pair of numbers, compute and report their sum and product, and go on to process the next pair until the end of input.

Put your solution in the form of a class named LargeNumbers, which uses the Node class to provide nodes for the linked list representation. There should be, among other things,

- a method to read/get the input from file/keyboard

- a method to put a large number into a linked list

- a method to add two large numbers

- a method to multiply two large numbers

- a method to output a large number

The main method must look like this pseudo-code:

While (not end of input)

{

Get/Read and echo a pair of numbers N1 and N2;

Output sum (N1, N2);

Output product (N1, N2);

}

So here’s a sample output:

LargeNumber1: 1 506 033 005 018 000 029

LargeNumber2: 1 992

Sum is: 1,506,033,005,018,002,021

Product is: 3,000,017,745,995,856,057,768

Test on a few pairs of large numbers.

### Recently Asked Questions

- According to socially accepted stereotypes, men prefer to have more sexual partners and are less committed to relationships than are women. What would be some

- QUESTION_3: Briefly summarize the purpose, research method, findings, and conclusions of studies that provide a scholarly foundation for your proposed (or

- How do i do question 10. letter H. I dont understand how to do it