Question: / / = = = = = = = = = = = = = = = = = = = = = = =
CSCI Data Structures
Instructor: Yao Xu PhD
Coding Assignment
Requirements
Write a recursive algorithm for computing x to the nth power using
the recursion defined on page of Module Slides: Recursion.
Please use appropriate data types and design appropriate output
to demonstrate the correctness of your code.
Please prompt the user to enter the base and exponent values.
Your output may look as follows:
Please enter the base value:
Please enter the nonnegative integer exponent value:
raised to the power of is:
A total of recursive calls were made to the power method.
Please enter the base value:
Please enter the nonnegative integer exponent value:
raised to the power of is:
A total of recursive calls were made to the power method.
Note
DO NOT MODIFY OR DELETE ANY GIVEN CODE OR COMMENTS!!!
You ONLY need to write code under each comment "YOUR CODE GOES HERE".
Modify the file name to "Power.java" to compile and run.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
