66 960
Assignments Done
99,2%
Successfully Done
In November 2018

Answer to Question #14080 in C++ for shalenee

Question #14080
(financial application: loan amortization schedule c++). The monthly payment for a given loan pays the principal and the interest. the monthly interest is computed by multiplying the monthly interest rate and the balance (the remaining principal). the principal paid for the month is therefore the monthly payment minus the monthly interest. write a program that lets the user enter the loan amount, number of years, and interest rate, then displays the amortization schedule for the loan.
Expert's answer
#include <iostream>
#include <conio.h>


using namespace std;

int _tmain(int argc, _TCHAR* argv[])
{

cout<<"Loan Amount: ";
int loanAmount;
cin>>loanAmount;
double balance = loanAmount;
cout<<"Number of Years: ";
int numberOfYears;
cin>>numberOfYears;
cout<<"Annual Interest Rate In Percent: ";
double annualInterestRate;
double k;
cin>> k;
annualInterestRate=k/100;
double monthlyInterestRate = annualInterestRate / 12;
double monthlyPayment = loanAmount * monthlyInterestRate / (1 - 1 / pow(1 + monthlyInterestRate, numberOfYears *
12));
double totalPayment = monthlyPayment * numberOfYears * 12;

printf("
Monthly Payment: $%.2f", monthlyPayment);
printf("
Total Payments: $%.2f", totalPayment);

printf("

Payment # Interest Principal Balance
");
for (int month = 1; month <= numberOfYears * 12; month++) {
double monthlyInterest = monthlyInterestRate * balance;
double principal = monthlyPayment - monthlyInterest;
balance = balance - principal;

printf("%d $%.2f $%.2f $%.2f
", month, monthlyInterest, principal, balance);
}
getch();
return 0;
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be first!

Leave a comment

Ask Your question

Submit
Privacy policy Terms and Conditions