Question: Problem Description 1. write a java program to read two positive integer numbers each up to 30 digits, and then add them and print the

Problem Description

1. write a java program to read two positive integer numbers each up to 30 digits, and then add them and print the result along with input numbers.

2. Sample run of the program:

input first number: 39983928349458

input second number: 92387486729

39,983,928,349,458 +

92,387,486,729

--------------------

40,076,315,836,187

Notes:

1. If each input is maximum 30 digits long, then their sum will be maximum 31 digits long.

2. You should read two numbers as String since none of the primitive data types can hold numbers of 30 digits long.

3. You are not allowed to use java's BigInteger, BigDecimal, or similar classes. You should use arrays and create your own algorithm, otherwise, you soulution will not be marked.

4. Split your program into small methods.

5. Do not verify user's input. Assume user input correct data.

6. Run the program from command window. Using Scite to read data from the keyboard may cause exception.

7. You should input your numbers without comma, but the output should be printed with comma as shown in the example.

8. Develope pseudo code only for the engine part of the program as discussed in the lab.

Bonus Part [10 marks]:

  1. Beside addition, multiply two numbers.
  2. Sample output of the program for bonus part:

39,983,928,349,458 x

92,387,486,729

-----------------------------------

3,694,014,649,758,837,849,342,882

If each input is maximum 30 digits long, then their multiplication will be maximum 60 digits long.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!