Question: 1) Write a recursive Java method power(double x, int n) that returns the values of xn. For example, power(2, 3) must have the value 8,
1) Write a recursive Java method power(double x, int n) that returns the values of xn. For example, power(2, 3) must have the value 8, assuming that n > 0.
2) Write a recursive Java method count(int d, int n) that will count the occurrences of the digit d in the number n. For example, count(3, 23533) will have the value 3.
3) Write a recursive Java method sumDigits(int n) that returns the sum of the digits in the number n. For example, sumDigits(2345) is 14.
Print-out of the source code of three recursive methods (just the methods need to be printed out).
Step by Step Solution
3.41 Rating (154 Votes )
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
