Calculator
Calculator – simple interest
payment
i * principle
1 1 ^ term 1 i
i – interest rate on the loan term – length of time to repay the loan
principle – amount borrowed
Calculator
Calculating the payment is a two-step process: 1. Convert input to term of the loan 2. Calculate the payment
Input: Amount of Loan – Principle Term of the Loan – Years Interest Rate – Yearly rate, expressed as a percentage
Example: Loan – $15,000 Term – 5 years Interest – 4.9 We want to retain the input for use in display; therefore, we need to have separate variables for the converted data
Calculator
payment
i * principle
1 1 ^ term 1 i
Calculating the payment i – interest rate, converted to the payment schedule (interest/month - im) term – number of payments (number of months)
payment
im * principle
1 1 ^ months 1 im
Calculator
Term: Entered as years – needs to be converted to months
Interest:
Entered as a whole number – needs double conversion First – convert to the decimal equivalent Second – convert to the monthly equivalent
months – term of loan in months id – Interest rate in decimal value
im – Interest rate in monthly decimal value
Calculator
Calculate the payment in steps (like in the quadratic problem) Calculate the numerator
N im * principle
Calculate the embedded term
Calculate the denominator
1 D1 1 im
D 1 D1^ months
Calculate the payment
N Payment D
Calculator
To calculate the monthly payment is a two–step process: – Convert the input to values appropriate for the payment cycle – Use the converted values to calculate the monthly payment
Now that we have a monthly payment, we can calculate the remaining information on the loan:
Total Payment – the amount actually paid out of your pocket. Total Interest paid over the life of the loan
Calculator
Total Payment – the amount actually paid out of your pocket. Total payment is the monthly payment multiplied by the number of payments made over the life of the loan TotalPay = payment * months
Total Interest paid over the life of the loan Interest paid is the difference between what you originally borrowed what you pay back TotalInt = TotalPay - principle
Calculator
To calculate a loan payment, the program should be written with each module completing a given task.
One module should do the necessary conversions:
Loan length to number of payments (usually that is years to months) Interest rate from a percentage value to the equivalent decimal value, then to the interest rate per payment term (quarter, months, weeks)
Calculator
To calculate a loan payment, the program should be written with each module completing a given task.
One module should do the necessary calculations:
payment
im * principle
1 1 ^ months 1 im
Once the payment is calculated, total amount paid and total interest paid can be calculated. These can be part of the payment calculation module.