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

Develop a program that helps people calculate montly mortgage payment for two di

ID: 3620524 • Letter: D

Question

Develop a program that helps people calculate montly mortgage payment for two different loan options. The program should prompt the user for the loan principan, and interest rates and lengths of two loan options. The program shouldcalculate the monthly payment for each loan using M = p * (j/1 - (1+ j) ** -n)) and using the pow() function. We are to use if's and else as well.

I keep going round and round with the compiler with it wanting me to stick a ; in front of the && and when I do it doesn't seem to recognize it. I really think my code has some logical errors and the compiler wants me to place something that really isn't correct. I need help in making sure the structure/ logic is correct. I'm not sure the curly braces are all correct either.
Thanks.

#include <iostream>
#include <cstdlib>
#include <cmath>
using namespace std;

int main()
{

int numYears;
double loanAmount;
double principal ;
double rate ;
double j;

cout << "Enter loan amount.";
cin >> loanAmount;
cout << "Enter the years of the loan." ;
cin >> numYears;

if (numYears <= 15)

rate = 0.095;
else
(numYears >=15 && numYears <=30);
{
rate=0.0725;
if
((numYears == '30' || numYears == '40'))
(rate = 0.045);

{
double n && Loan Length = numYears * 12;

double j = rate/12;
double m = 1 -(1+j);
double p = pow(m,-n);
double x = j/p;
double monthlyPayment= principal * x;
cout << "Your monthly payment is: "<< monthlyPayment<< " at yearly interest rate of "<<
rate<< "for " <<numYears<< "years" ;
}
system ("pause");
}
return 0;
}














Explanation / Answer

Try using this as a template. This should work for you. #include #include #include using namespace std; int main() { // Declare Variables double loan, rateMonth, rateYear, payment, interest; int numPayments; // Assign values cout > loan; cout > rateYear; cout > numPayments; // Calculations rateYear = rateYear /100; rateMonth=rateYear / 12; payment = (((pow(rateMonth+1,numPayments)) * rateMonth)/((pow(rateMonth+1,numPayments)-1))) * loan; // Output cout