Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

The monthly payment due on an outstanding car loan is typically calculated using

ID: 3542911 • Letter: T

Question

The monthly payment due on an outstanding car loan is typically calculated using the formula:


Monthly payment = ((Loan amount)*(Monthly interest rate)) / (1.0 - (1.0 + Monthly interest rate) ^(- (number of months))


Where

Monthly interest rate = Annual percentage rate / (12.0 *100)


Using these formulas write an algorithm that prompts the user for the amount of the loan, the annual percentage rate, and the number of years of the loan. From this input data produce a loan amortization table similar to the one shown below:

What is the amount of the loan? $ 1500.00

What is the annual percentage rate? 14.0

How many years will you take to pay back the loan? 1.0


Amount    Annual % Interest    Years    Monthly Payment

1500.00              14.00                 1               134.68


Payment              Interest             Principal          Cumulative          Total Paid       New Balance

Number                  Paid                    Paid               Interest                 to Date                 Due

1                              17.50                 117.18             17.5                     134.68             1382.82

2                              16.13                 118.55             33.63                   269.36             1264.27

3                              14.75                 119.93             48.38                   404.04             1144.34

4                              13.35                 121.33             61.73                   538.72             1023.01

5                              11.94                 122.75             73.67                   673.4                 900.27

6                               10.5                   124.18            84.17                   808.08               776.09

7                                9.05                  125.63            93.23                   942.76                650.46

8                                7.59                  127.09            100.81               1077.45               523.37

9                                6.11                  128.57            106.92               1212.13               394.79

10                              4.61                  130.07            111.53               1346.81               264.72

11                              3.09                  131.59            114.61               1481.49               133.13

12                              1.55                  133.13            116.17               1616.17                   0.00



In constructing the loop necessary to produce the body of the table, the following initializations must be made:

New balance due = original loan amount

Cumulative interest = 0.0

Paid to date = 0.0

Payment number = 0


Within the loop the following calculations and accumulations should be used:

Payment number = payment number + 1

Interest paid = new balance due + monthly interest rate

Principal paid = monthly payment

Explanation / Answer

#include<iostream>
#include<iomanip>
#include<cmath>
using namespace std;
int main()
{
double loan_amount,rate,years;
double Monthly_payment;
cout <<"What is the amount of the loan? $ ";
cin >> loan_amount;
cout <<endl;
cout <<"What is the annual percentage rate? ";
cin >> rate;
cout <<endl;
while(rate<1 || rate >20)
{
cout << "Invalid percentage rate entered. " << endl;
cout <<"What is the annual percentage rate? ";
cin >> rate;
cout <<endl;
}
double monthly_rate = rate/(12*100);
cout <<"How many years will you take to pay back the loan? ";
cin >> years;
cout << endl;
Monthly_payment = ((loan_amount)*(monthly_rate)) / (1.0 - pow((1.0 +monthly_rate),(-years*12)));
cout <<"Amount : " << loan_amount << endl;
cout << "Annual % interest: " <<rate << endl;
cout <<"years : " << years << endl;
cout <<"Monthly Payment : " << Monthly_payment <<endl;
cout << "Payment Interest Principal Cumulative   Total Paid    New Balance " << endl;
cout << "Number   Paid       Paid      Interest   to Date         Due " << endl;
int payment_number =1;
double new_balance_due = loan_amount;
double cumulative_interest =0;
double paid_to_date=0;
for(int payment_number=1; payment_number<=12; payment_number++)
{
double Interest_paid = new_balance_due*monthly_rate;
double Principal_paid = Monthly_payment-Interest_paid;
cumulative_interest = cumulative_interest + Interest_paid;
paid_to_date = paid_to_date+ Monthly_payment;
new_balance_due = new_balance_due-Principal_paid;
cout << payment_number << " " <<
fixed << setw(5) << setprecision(2) << Interest_paid << " " <<
fixed << setw(5) << setprecision(2) << Principal_paid << " "<<
fixed << setw(5) << setprecision(2) << cumulative_interest << " " <<
fixed << setw(5) << setprecision(2) << paid_to_date << " " <<
fixed << setw(5) << setprecision(2)<< new_balance_due << endl;
}
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote