Mortgage MAT 215 Test 1 (lab) Data types, string input, constants, functions Wri
ID: 3869640 • Letter: M
Question
Mortgage MAT 215 Test 1 (lab) Data types, string input, constants, functions Write a C++ program to compute the monthly mortgage pay 1. Get input: Read in the following information about the client: Fall 2017 Dr. Ye nts, mathematical functions, type casting, formatting output. ment. Steps: First name, middle initial, last name Amount of loan L ·Mortgage term in years N (# of years). allow spaces in a nam 2. Compute the monthly mortgage payment using the following formula: pi.L where L is the amount of the loan in dollars, P is the monthly payment, i is the monthly interest rate (i-1+ 12, where 1 is the annual interest rate), n is the mortgage term in months (n number of monthly payments Nx12) Note: In the program, treat the annual interest rate I as a constant 3. Display the result in a neat format, with the result rounded to 2 decimal places. The factors affecting the program score include program format, compiling and execution correctness, output format. Here is a sample output: Enter your first name: John Enter your middle initial: z Enter your last name: Doe, Jr. Currently, the annual interest rate is 4.068. Now please enter the amount of loan: $300000 In how many years do you want to pay off the loan? 15 MONTHLY MORTGAGE PAYMENT CALCULATION Client: John 2. Doe, Jr. Loan amount: $300000.00 Loan Term: 180 Months Annual Interest Rate: 4.06% Monthly Payment: $2228.09Explanation / Answer
#include <iostream>
#include<math.h>
using namespace std;
int main() {
// your code goes here
char f_name[10],m_name[10],l_name[10];
float L,P,n,N;
float x,y,I=4.06,i,p;
cout<<" Enter the First name:";
cin>>f_name;
cout<<" Enter the Middle name:";
cin>>m_name;
cout<<" Enter the Last name:";
cin>>l_name;
cout<<" Currently the annual Interest is "<<I;
cout<<" Now please Enter the amount of loan";
cin>>L;
cout<<" In how many years do you want to pay back the loan";
cin>>N;
i=I/12;
n=N*12;
x-1+i;
y=pow(x,n);
p=((i*y)/(y-1));
P=p^L;
cout<<" MONTHLY MORTAGE PAYMENT CALCULATION ";
cout<<" -----------------------------------";
cout<<" tClient :"<<f_name<<" "<<m_name<<" "<<l_name;
cout<<" loan amount :"<<L;
cout<<" Loan term :"<<N;
cout<<" Annual Interest Rate :"<<I;
cout<<" ****Monthly payment : $"<<P;
return 0;
}
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.