# one question in java(needed ASAP)

Dec 5th, 2014
RockCafe
Category:
Computer Science
Price: \$25 USD

Question description

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

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

}

}

*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.

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

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

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

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

(Top Tutor) Daniel C.
(997)
School: Boston College

Studypool has helped 1,244,100 students

## Review from our student for this Answer

SoccerBoss
Dec 7th, 2014
"Excellent work as usual"

1830 tutors are online

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