Question: / / = = = = = = = = = = = = = = = = = = = = = = =

//========================================================================
// CSCI 3230 Data Structures
// Instructor: Yao Xu, Ph.D.
//
// Coding Assignment 1
//
//=========================== Requirements ===============================
//
// Write a recursive algorithm for computing x to the nth power using
// the recursion defined on page 9 of Module 2 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: 2
// Please enter the non-negative integer exponent value: 9
//2.0 raised to the power of 9 is: 512.0
// A total of 5 recursive calls were made to the power method.
//------------------------------------------------------------------------
// Please enter the base value: 3.5
// Please enter the non-negative integer exponent value: 6
//3.5 raised to the power of 6 is: 1838.265625
// A total of 4 recursive calls were made to the power method.
//
//============================== Note ====================================
//
//1. DO NOT MODIFY OR DELETE ANY GIVEN CODE OR COMMENTS!!!
//2. You ONLY need to write code under each comment "YOUR CODE GOES HERE".
//3. 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 blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!