# 1 program for java ( ASAP)

**Question description**

Hello!

please answer this :

Write a program which contains a main() method and a method multiplyEvens() that returns the product of the first n even integers. (2pts)

For example:

multiplyEvens(1) returns 2

multiplyEvens(2) returns 8 (2 * 4)

multiplyEvens(3) returns 48 (2 * 4 * 6)

multiplyEvens(4) returns 384 (2 * 4 * 6 * 8)

multiplyEvens(5) returns 3840 (2 * 4 * 6 * 8 * 10)

Remark: You may NOT use a while loop, for loop or do/while loop to solve this problem; you MUST use recursion. The method should check whether the argument is greater than 0.

public static int multiplyEvens(int n) {

if (n < 1) {

throw new IllegalArgumentException();

} else if (n == 1) {

return 2;

} else {

// Fill your recursive code here

}

}

[Extra Credit] Write recursive methods of the following problems and the associate test driver program. All of them are covered in class. Please refer to the class materials and lecture. (4pts)

(1) Factorial Number : Factorial (int n) : returns n! number. (1pt)

(2) Fibonacci : Fibonacci (int n) : returns n'th Fibonacci number. (1pt)

(3) PowerE : PowerE (int base, int exponent) : returns the based raised to that exponent, n. (1pt)

(4) PrintBinary : PrintBinary (int n) : returns corresponding binary number (String) of the decimal number n. (1pt)

## Tutor Answer

Brown University

1271 Tutors

California Institute of Technology

2131 Tutors

Carnegie Mellon University

982 Tutors

Columbia University

1256 Tutors

Dartmouth University

2113 Tutors

Emory University

2279 Tutors

Harvard University

599 Tutors

Massachusetts Institute of Technology

2319 Tutors

New York University

1645 Tutors

Notre Dam University

1911 Tutors

Oklahoma University

2122 Tutors

Pennsylvania State University

932 Tutors

Princeton University

1211 Tutors

Stanford University

983 Tutors

University of California

1282 Tutors

Oxford University

123 Tutors

Yale University

2325 Tutors