Question

In: Computer Science

C++ Write a program that outputs an amortization schedule for a given loan. Must be written...

C++

Write a program that outputs an amortization schedule for a given loan.

  • Must be written using user-defined functions
  • must take at least 1 argument
  • Output number of months, payment, interest to pay, principle to pay, and ending balance

Solutions

Expert Solution

C++ Program:

#include <iostream>

#include <cmath>

#include <iomanip>

using namespace std;

void amortizationLoan(int years, double principal,double InterestRate);

int main()

{

  int years;

  double  principal;

  double  InterestRate;

cout << "Please enter the Loan amount that has taken: ";

  cin>> principal;

cout << "Please enter the interst: ";

  cin >> InterestRate;

cout << "Please enter the number of years: ";

  cin >> years;

amortizationLoan(years,principal,InterestRate);

return 0;

}

void amortizationLoan(int years, double principal,double InterestRate)

{

  double  periodicInterestRate = InterestRate / 12;

  int NumMonths = years * 12;

  double  payment = principal * periodicInterestRate / (1 - pow(1 + periodicInterestRate, -NumMonths));

  cout.setf(ios::fixed);    

  cout.precision(2);    

cout << "My payment is: " << payment << endl;

double  balance = principal;

  double  total_interest = 0;

  double  total_principal = 0;

int months = 0;

  for (int i = 1; i <= NumMonths; i++)

  {

    double  to_interest = balance * periodicInterestRate;

    double  to_principal = payment - to_interest;

    total_interest += to_interest;

    total_principal += to_principal;

balance -= (payment - to_interest);

months++;

  }

cout<<"number of months: "<<months<<"\n";

cout<<"Interest to pay: "<<total_interest <<"\n";

cout<<"principle to pay: "<<total_principal<<"\n";

cout<<"ending balance: "<<balance<<"\n";

cout<< "Total Paid including interest: "<<total_principal+total_interest;

}

OUTPUT:

Please enter the Loan amount that has taken: 30000
Please enter the interst: 0.08
Please enter the number of years: 3
My payment is: 940.09
number of months: 36
Interest to pay: 3843.27
principle to pay: 30000.00
ending balance: -0.00
Total Paid including interest: 33843.27


Related Solutions

write a program on c++ that outputs a calendar for a given month in a given...
write a program on c++ that outputs a calendar for a given month in a given year, given the day of the week on which the 1st of the month was. The information in numeric format (months are: 1=Januay, 2=February 3=March, 4= April, 5= May, 6= June, 7= July... etc days are 1=Sunday, 2=Monday, 3= Tuesday, 4= Wednesday, 5= Thursday, 6= Friday and 7= Saturday ). The program output that month’s calendar, followed by a sentence indicating on which day...
AMORTIZATION SCHEDULE a. Complete an amortization schedule for a $25,000 loan to be repaid in equal...
AMORTIZATION SCHEDULE a. Complete an amortization schedule for a $25,000 loan to be repaid in equal installments at the end of each of the next three years. The interest rate is 8% compounded annually. Round all answers to the nearest cent. Beginning Repayment Ending Year Balance Payment Interest of Principal Balance 1 $ $ $ $ $ 2 3 b. What percentage of the payment represents interest and what percentage represents principal for each of the three years? Round all...
Amortization schedule Set up an amortization schedule for a $36,000 loan to be repaid in equal...
Amortization schedule Set up an amortization schedule for a $36,000 loan to be repaid in equal installments at the end of each of the next 3 years. The interest rate is 6% compounded annually. Round all answers to the nearest cent. Beginning Remaining Year Balance Payment Balance 1 $   $   $   2 $   $   $   3 $   $   $   What percentage of the payment represents interest and what percentage represents principal for each of the 3 years? Round all answers...
Finance- Amortization Schedule Create the amortization schedule for a loan of $5,000, paid monthly over two...
Finance- Amortization Schedule Create the amortization schedule for a loan of $5,000, paid monthly over two years using an 8 percent APR.
EXCEL: Complete the loan amortization schedule in the green cells below. You must use at least...
EXCEL: Complete the loan amortization schedule in the green cells below. You must use at least one of the following formulas (PMT, IPMT, PPMT) in your solution. Years Periods per year 30 12 Period PMT Interest Principal Paid Balance Annual Interest Rate Lump Sum 0 350,000.00 1 0.08 2 0.08 3 0.08 10,000.00 4 0.08 5 0.08 6 0.08 7 0.08 8 0.08 9 0.08 10 0.08 11 0.08 12 0.08 13 0.085 14 0.085 15 0.085 16 0.085
Problem 5-50 Amortization Schedule (LG9) Create the amortization schedule for a loan of $4,300, paid monthly...
Problem 5-50 Amortization Schedule (LG9) Create the amortization schedule for a loan of $4,300, paid monthly over two years using an 9 percent APR. (Round your answers to 2 decimal places.)       Month   Beginning Balance   Total Payment   Interest Paid   Principal Paid   Ending Balance 1                               2                               3                               4                               5                               6                               7  ...
Problem 5-49 Amortization Schedule (LG9) Create the amortization schedule for a loan of $14,000, paid monthly...
Problem 5-49 Amortization Schedule (LG9) Create the amortization schedule for a loan of $14,000, paid monthly over three years using a 9 percent APR. (Round your answers to 2 decimal places.)    Month Beginning Balance Total Payment Interest Paid Principal Paid Ending Balance 1                2                3                4                5                6                7...
Create a loan amortization schedule in excell for a $27,000 car loan that will be repaid...
Create a loan amortization schedule in excell for a $27,000 car loan that will be repaid over 48 months at an annual interest rate of 6%. What is your monthly payment? _$_ What is the total dollar amount of payments made over the life of this loan? $____ What is the total dollar amount of interest paid over the life of this loan? $___________ How many months will it take to pay off the loan if you pay an extra...
Prepare an amortization schedule for a three-year loan of $24,000.
Prepare an amortization schedule for a three-year loan of $24,000. The interest rate is 16 percent per year, and the loan calls for equal principal payments.
1A) Construct a loan amortization schedule for a 15 year, 7.75% loan of $10,000,000. The loan...
1A) Construct a loan amortization schedule for a 15 year, 7.75% loan of $10,000,000. The loan requires equal, end-of-year paymens, and interest compounded monthly. b) what is the total amount of interest paid over the life of the loan? c) Assume that there is a balloon payment requirment after 10 years. What is the balloon payment in section a?
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT