Purchase Solution

Recursive power Method - Java

Not what you're looking for?

Ask Custom Question

Write a recursive method power( base, exponent ) that, when called, returns

exponent
base

For example, power( 3,4 ) = 3*3*3*3. Assume that exponent is an integer greater than or equal to 1. [Hint: The recursion step should use the relationship

exponent exponent-1
base = base*base

and the terminating condition occurs when exponent is equal to 1, because

1
base = base

Incorporate this method into a program that enables the user to enter the base and exponent.]

Purchase this Solution

Purchase this Solution


Free BrainMass Quizzes
Java loops

This quiz checks your knowledge of for and while loops in Java. For and while loops are essential building blocks for all Java programs. Having a solid understanding of these constructs is critical for success in programming Java.

Basic Networking Questions

This quiz consists of some basic networking questions.

C++ Operators

This quiz tests a student's knowledge about C++ operators.

Javscript Basics

Quiz on basics of javascript programming language.

Excel Introductory Quiz

This quiz tests your knowledge of basics of MS-Excel.