Part I
Consider a simple recursive method such as calculating the sum of the first n natural numbers, calculating the number of digits of an integer number, calculating 2 to the power of n, etc. (a) Show method code and indicate what it does and what represent its parameter(s) and the return value; (b) Identify the base case(s) and indicate how each recursive call simplifies the problem and makes progress towards the base case; (c) For the chosen method, identify the circumstances of infinite method calls.

Design, implement and test a Java program which includes an iterative method multIterative and a recursive method multRecursive. Both methods take the same parameters, the two positive integer numbers that will be multiplied and return the multiplication result. For both methods, use the technique of repetitive additions for achieving the multiplication of the two numbers. As an example, 4 multiplied by 6 should be calculated as 6 + 6 + 6 + 6 (i.e. four times six).

This program should also include the main method. In the main method, invite the user to enter two positive integer numbers and invoke each of the two methods to multiply the numbers and display the result. If incorrect input values are entered, a warning should be displayed and the user will be invited, in the same execution session, to re-enter a legal value. The program should allow the user to repeat multiplication tests.

Part II
Experiment the behavior of the two methods when multiplying large numbers such as 50,000 X 50,000. Observe what happens, discuss the results and if necessary, implement corrective actions in the program source code.

Your program should compile and run without errors.

1. Java source file
2. A document file (.pdf or .doc/.docx) describing your solution which should include the following sections: (1) A short problem analysis, (2) Design decisions and assumptions, (3) Short description of classes, (4) User interface, (5) Relevant test cases and screenshots, (6) Error handling, (7) Lessons learned and (8) Possible future developments. The size of the document should be of 3 pages, single spaced, font size 12.

Solution PreviewSolution Preview

This material may consist of step-by-step explanations on how to solve a problem or examples of proper writing, including the use of citations, references, bibliographies, and formatting. This material is made available for the sole purpose of studying and learning - misuse is strictly forbidden.

public class Multiplication {

    public static void main(String[] args) {
       Scanner keyboard = new Scanner(;
       int num1, num2;
       long start;
       long end;
       String answer = "";
       /// this is used to enlarge the stack of our java
       multRecursive(10000, 10000);
       multRecursive(20000, 20000);
       multRecursive(30000, 30000);
       multRecursive(40000, 40000);
       multRecursive(50000, 50000);
       while (true) {            
            num1 = getInt("Enter the first factor: ", keyboard);
            num2 = getInt("Enter the second factor: ", keyboard);
            start = System.nanoTime();
            multIterative(num1, num2);
            end = System.nanoTime();...
$23.00 for this solution

PayPal, G Pay, ApplePay, Amazon Pay, and all major credit cards accepted.

Find A Tutor

View available Java Programming Tutors

Get College Homework Help.

Are you sure you don't want to upload any files?

Fast tutor response requires as much info as possible.

Upload a file
Continue without uploading

We couldn't find that subject.
Please select the best match from the list below.

We'll send you an email right away. If it's not in your inbox, check your spam folder.

  • 1
  • 2
  • 3
Live Chats