Redefine the method power (Display 11.3) so that it also works for negative exponents. To do this, you also have to change the type of the value returned to double. The method heading for the...



Redefine the method power (Display 11.3) so that it also works for negative


exponents. To do this, you also have to change the type of the value returned to


double. The method heading for the redefined version of power is as follows:


/**


Precondition: If n <>



Returns x to the power n.


*/


public static double power(int x, int n)


Hint: x-n is equal to 1√(xn).



May 19, 2022
SOLUTION.PDF

Get Answer To This Question

Submit New Assignment

Copy and Paste Your Assignment Here