Complete the definition of the following method. Your definition should
be recursive. Unlike the method in Question 5, this method does not
restrict the sign or value of its argument. You can use the same technique
you used for Question 5, but you should have one more recursive case for
negative exponents. (Hints: 10n
is 1/10–n
for negative values of n. Also, if n
is negative, –n is positive.)
/**
Precondition: n can be any int.
Returns 10 to the power n.
*/
public static int computeTenToThe(int n)
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here