Suppose we want to compute the amount of money in a bank account with compound interest. If the amount of money in the account is m, the amount in the account at the end of the month will be 1.005m. Write a recursive method that will compute the amount of money in an account after t months with a starting amount of m.
What will be an ideal response?
```
public static double compoundInterest(double start, int months){
double result;
if(months <= 0){
result = start;
} else {
result = 1.005 * compoundInterest(start, months-1);
}
return result;
}
```
This code is in Methods.java.
Computer Science & Information Technology
You might also like to view...
A shot is a piece of the story that is told with the camera in multiple positions.
Answer the following statement true (T) or false (F)
Computer Science & Information Technology
Revise the definition of the method getIndexOfso that it does not use aboolean variable.
What will be an ideal response?
Computer Science & Information Technology