Write a loan calculator program in C++ that displays monthly balances for user-specified loan terms. To be flexible, you decide to specify the loan terms in a file and provide that filename entered from the keyboard. To keep things simple, the loan terms (input) file will have the following syntax:
save the output in a file that is also specified entered from the keyboard.
The formula for calculating a monthly payment is:
P = the initial amount of the loan
I = the annual interest rate
J = monthly interest rate = (I / 100) / 12
N = number of months
M = monthly payment
J
M = P * (J + -------------)
N
( 1 + J) - 1
or
M = P * (J + (J / ((1+J)^N - 1)))
use this data
P = $2,800,000
I = 8.40% (that's the interest rate that I got for my Zonda :)
J = (8.4 / 100) / 12 = 0.007
N = 24 (2 years)
M = $2,800,000 * (0.007 + (0.007 / ((1+0.007)^24 - 1))) = $127,148.37
PLS PLEASE NOTE only the first and last three months be detailed by your program (and no more) and that they be separated with an ellipsis ("...").
THe output should look like this
Initial balance: $2800000.00
Number of payments: 24
Annual interest rate: 8.40%
Monthly payment: $127147.84
Month Interest Principal Balance
1 $19600.00 $107547.84 $2692452.25
2 $18847.17 $108300.68 $2584151.50
3 $18089.06 $109058.78 $2475092.75
...
22 $2633.15 $124514.69 $251650.28
23 $1761.55 $125386.29 $126263.99
24 $883.85 $126263.99 $0.00
Total interest paid: $251548.19