Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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_2

Step: 3

blur-text-image_3

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

Financial management theory and practice

Authors: Eugene F. Brigham and Michael C. Ehrhardt

12th Edition

978-0030243998, 30243998, 324422695, 978-0324422696

Students also viewed these Programming questions