Question: you will be creating a driver class only for this assignment which will include both the main method and the power method. You should be
you will be creating a driver class only for this assignment which will include both the main method and the power method.
You should be familiar with the Math.pow method which raises a value (n) to a power (x) which might be represented as n^x (ex. Math.pow(n, x)). you are to create a power method which recursively calculates the result of n^x. Here are a few reminders:
If x = 0, n^x is 1
If x > 0, an is n * n^x1
Your main method should prompt for and read in integers to serve as your base and exponent values and calls the power method to calculate base^exponent. Output to the user should be a part of a clear statement that includes the base value, exponent value, and calculated result.
Include clear comments throughout the program that explain the variables and what functionality the various lines/small sections of code are completing as related to the execution of the program.
Below is a sample of the output your program should produce:
Welcome to My version of Math.pow() which will calculate a base value (n) raised to a power (x) or n^x! Please enter your base value as an integer (ex. 10): 6 Please enter the integer value for the power to which you want to raise 6 (ex. 2): 7 Answer: 6^7 = 279936
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
