Problem statement: The monthly payment on a loan may be calculated by the follow
ID: 3542618 • Letter: P
Question
Problem statement: The monthly payment on a loan may be calculated by the following formula:
Rate is the monthly interest rate, which is the annual interest rate divided by 12. ( 12% annual interest would be 1 percent monthly interest.) N is the number of payments and L is the amount of the loan. Write a program that asks for these values and displays a report similar to:
Loan Amount: $ 10000.00
Monthly Interest Rate: 1%
Number of Payments: 36
Monthly Payment: $ 332.14
Amount Paid Back: $ 11957.15
Interest Paid: $ 1957.15
Problem statement: The monthly payment on a loan may be calculated by the following formula: Rate is the monthly interest rate, which is the annual interest rate divided by 12. ( 12% annual interest would be 1 percent monthly interest.) N is the number of payments and L is the amount of the loan. Write a program that asks for these values and displays a report similar to:Explanation / Answer
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
float annualInterestRate; // user
float monthlyInterestRate; // calc
float loanAmount; // user
float monthlyPayment; // calc
float numberOfPayments; // user
cout << "Enter the annual interest rate as a percent: ";
cin >> annualInterestRate;
cout << "Enter the number of payments: ";
cin >> numberOfPayments;
cout << "Enter the loan amount: ";
cin >> loanAmount;
monthlyInterestRate = (annualInterestRate / 12);
monthlyPayment = ((monthlyInterestRate * (pow (1 + monthlyInterestRate, numberOfPayments)))
/ ((pow (1 + monthlyInterestRate, numberOfPayments) - 1)) * loanAmount);
cout << "Loan Amount: " << loanAmount << endl;
cout << "Monthly Interest Rate: " << monthlyInterestRate << endl;
cout << "Number of Payments: " << numberOfPayments << endl;
cout << "Monthly Payment: " << monthlyPayment << endl;
cout << "Amount Paid Back: " << monthlyPayment * numberOfPayments << endl; // enter
cout << "Interest Paid: " << monthlyPayment * numberOfPayments - loanAmount << endl; //enter
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.