<img src="https://d5nxst8fruw4z.cloudfront.net/atrk.gif?account=iA1Pi1a8Dy00ym" style="display:none" height="1" width="1" alt="" />

# 8.3: A Personal Finance Example Using While Loops

Difficulty Level: At Grade Created by: CK-12

A student decides to finance their college education using a credit card. They charge one semester's tuition and then make the minimum monthly payment until the credit card balance is zero. How many months will it take to pay off the semester's tuition? How much will the student have spent to pay off the tuition?

We can solve this problem using an m-file script. We define the following variables:

• \begin{align*}b_n\end{align*} - Balance at month \begin{align*}n\end{align*}.
• \begin{align*}P_n\end{align*} - Payment in month \begin{align*}n\end{align*}.
• \begin{align*}f_n\end{align*} - Finance charge (interest) in month \begin{align*}n\end{align*}.

The finance charge \begin{align*}f_n\end{align*} is the interest that is paid on the balance each month. The finance charge is computed using the monthly interest rate \begin{align*}r\end{align*}:

\begin{align*}f_n = rb_n\end{align*}

Credit card interest rates are typically given as an annual percentage rate (APR). To convert the APR to a monthly interest rate, use the following formula:

\begin{align*}r = (1 + \frac{APR}{100})^\frac{1}{12} -1\end{align*}

More information on how to compute monthly rates can be found at the Wikipedia article "Credit card interest" (http://en.wikipedia.org/wiki/Credit_card_interest).

Credit cards usually have a minimum monthly payment. The minimum monthly payment is usually a fixed percentage of the balance; the percentage is required by federal regulations to be at least \begin{align*}1\end{align*}% higher than the monthly interest rate. If this minimum payment would be below a given threshold (usually \begin{align*}10\end{align*} to\begin{align*}20\end{align*}), the minimum payment is instead set to the threshold. For a threshold of \begin{align*}10\end{align*}, the relationship between the balance and the minimum payment can be shown in an equation as follows: \begin{align*}p_n = \text{max}((r + 0.01) b_n, 10)\end{align*} To compute the balance for one month (month \begin{align*}n + 1\end{align*}) from the balance for the previous month (month \begin{align*}n\end{align*}), we compute the finance charge on the balance in the previous month and add it to the previous balance, then subtract the payment for the previous month: \begin{align*}b_{n+1} = b_n + f_n - p_n\end{align*} In the following exercises, we will develop the program to compute the number of months necessary to pay the debt. We will assume that the card APR is \begin{align*}14.9\end{align*}% (the average rate on a student credit card in mid February 2006 according to http://money.cnn.com/pf/informa/index.html) and that the initial balance charged to the card is2203 (the in-state tuition at Arizona State University at the Polytechnic Campus for Spring 2006 semester according to http://www.asu.edu/sbs/FallUndergradEastWest.htm).

Exercise 5

Write code to compute the monthly interest rate \begin{align*}r\end{align*} from the APR.

Exercise 6

Write code to compute the minimum monthly payment \begin{align*}P_n\end{align*}.

Exercise 7

Write code to compute the balance at month \begin{align*}n + 1\end{align*} in terms of the balance at month \begin{align*}n\end{align*}.

Exercise 8

Place the code developed for Exercise 7 into a while loop to determine how many months will be required to pay off the card.

Exercise 9

Modify your code from Exercise 8 to plot the monthly balance, monthly payment, and total cost-to-date for each month until the card is paid off.

### Notes/Highlights Having trouble? Report an issue.

Color Highlighted Text Notes

Show Hide Details
Description
Tags:
Subjects: