Docsity

Program Simplification for Loan Calculations: A and P Given, Assignments of Computer Science

Toggle sidebar
bg1
Program simplification: You can require that the user provide the term and the interest
rate always. The user can then leave either the payment amount or the principle amount
blank. Hence the rate method and the term methods are not required.
Remember that the user is to type in the term in years, and the interest rate as a
percentage. Example 30 years at 15.5%, the user would enter a term of 30 and a rate of
15.5. Your java code should convert the years to months and the term to a decimal
representation before calling the A given P and P given A methods of the Loan class.
THE EQUATIONS:
------------------------
In both equations, i equals the percentage interest rate expressed as a decimal value
divided by 12. (It's the monthly interest rate expressed as a decimal value.) Example
24% would become 24 divided by 100 divided by 12, i = 0.02.
In both equations, n equals the total number of months, so if the term is 30 years, n = 30
times 12, or 360.
"A" stands for the payment amount, and "P" stands for the principle amount.
I use the A given P and P given A terminology because it is the commonly used
expression for these equations.
Equation 1: Used to calculate the payment when you know the principle, monthly
interest rate as a decimal, and term in months.
n
"A given P" conversion factor i * ( 1 + i )
----------------------------------
n
( 1 + i ) - 1
Use that factor times "P" (the principle) to calculate the "A" or payment.
Equation 2: Used to calculate the principle when you know the payment amount,
monthly interest rate as a decimal, and the term in months.
n
"P given A" conversion factor ( 1 + i ) - 1
-------------------------------------
n
i * ( 1 + i )
Use the "P given A" conversion factor to multiply by "A" (the monthly payment amount)
to calculate the "P" or principle or present value of the loan.

Partial preview of the text

Download Program Simplification for Loan Calculations: A and P Given and more Assignments Computer Science in PDF only on Docsity!

Program simplification: You can require that the user provide the term and the interest rate always. The user can then leave either the payment amount or the principle amount blank. Hence the rate method and the term methods are not required.

Remember that the user is to type in the term in years, and the interest rate as a percentage. Example 30 years at 15.5%, the user would enter a term of 30 and a rate of 15.5. Your java code should convert the years to months and the term to a decimal representation before calling the A given P and P given A methods of the Loan class.

THE EQUATIONS:

In both equations, i equals the percentage interest rate expressed as a decimal value divided by 12. (It's the monthly interest rate expressed as a decimal value.) Example 24% would become 24 divided by 100 divided by 12, i = 0.02.

In both equations, n equals the total number of months, so if the term is 30 years, n = 30 times 12, or 360.

"A" stands for the payment amount, and "P" stands for the principle amount.

I use the A given P and P given A terminology because it is the commonly used expression for these equations.

Equation 1: Used to calculate the payment when you know the principle, monthly interest rate as a decimal, and term in months.

n "A given P" conversion factor i * ( 1 + i )


n ( 1 + i ) - 1

Use that factor times "P" (the principle) to calculate the "A" or payment.

Equation 2: Used to calculate the principle when you know the payment amount, monthly interest rate as a decimal, and the term in months. n "P given A" conversion factor ( 1 + i ) - 1


n i * ( 1 + i )

Use the "P given A" conversion factor to multiply by "A" (the monthly payment amount) to calculate the "P" or principle or present value of the loan.