Write an algorithm to settle the following question: A bank account starts out with $10,000. Interest is compounded monthly at 0.5 per cent per month. Every month, $500 is withdrawn to meet college expenses. After how many years is the account depleted?
State the current bank statement total is $10,000
State the monthly rate is 0.5% (0.005)
State the monthly withdrawal amount is $500
Initial the number of months that the account is depleted is 0
When the current bank statement is no less than 500, calculate the following:
The current bank statement = (current bank statement – monthly withdrawal) * ( 1 – monthly rate)
Number of months = number of months + 1
Return Number of months + 1