[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
## A Function to Calculate Credit Cart Limit

**From**: |
nkaplan |

**Subject**: |
A Function to Calculate Credit Cart Limit |

**Date**: |
Wed, 18 Nov 2015 12:59:10 -0800 (PST) |

Hi,
I need a function to solve a problem. Let's assume we have a credit card and
we're going to pay 12.000$ for something today. We will be paying only 20%
of our remaining debt balance per month. There will be 2.5% interest rate
per month for unpaid debt. For example, at first month, we will pay
12.000*0.2=2400$. Then, unpaid debt (which is 9600$) will be bringing extra
9600*0,025=240$. So, our debt will be 9600+240=9840$. Then, we pay 20% of it
which is 9840*0,2=1968$, and so on.
When the remaining debt balance will be less than or equal to 10$, we will
pay 10$ but no 10*8=8$.
I need a function: it will ask me amount of my payment (today), duration
(month), interest rate ( and then it calculates credit card limit that
enables me to pay 12.000$ today.
I've written something like this but it lacks of something. I guess I need a
'for' loop for this. Also, I've written F*0.2 but it is clearly not true
because we will be paying 20% of remaining debt balance, not 20% of total
debt.
function limit
F=input('Amount of your payment-today')
t=input('how many months you will be paying')
r=input('interest rate for remaining debt balance')
y=(F-(F*0.2))*((1+r)^t)
end
fprintf('The credit limit you need today is %d\n',y)
--
View this message in context:
http://octave.1599824.n4.nabble.com/A-Function-to-Calculate-Credit-Cart-Limit-tp4673558.html
Sent from the Octave - General mailing list archive at Nabble.com.

**A Function to Calculate Credit Cart Limit**,
*nkaplan* **<=**