Answer:
Since the programming language is not specified in the question, we will write the code in C++ language.
The C++ code along with comments for explanation and output results are provided below.
C++ Code with Explanation:
#include <iostream>
using namespace std;
int main()
{
int CurrentMonthPrice;
int LastMonthPrice;
int ChangeInPrice;
// since the value of mortgage can result in fraction so we will use float type for it
float MonthlyMortgage;
// get the current month price from the user
cout<<"Input the current month price: ";
cin>>CurrentMonthPrice;
// get the last month price from the user
cout<<"Input the last month price: ";
cin>>LastMonthPrice;
// compute the change in price since last month
ChangeInPrice = CurrentMonthPrice - LastMonthPrice;
// compute the monthly mortgage of the house as per the formula given in the question
MonthlyMortgage = (CurrentMonthPrice*0.045)/12;
// print the output summary
// print the current price of the house
cout<<"This house is $"<<CurrentMonthPrice<<endl;
//Print the change in the price of the house since last month
cout<<"The change is $"<<ChangeInPrice<<" since last month"<<endl;
// print the estimated monthly mortgage
cout<<"The monthly mortgage is $"<<MonthlyMortgage<<endl;
return 0;
}
Output:
Input the current month price: 200000
Input the last month price: 210000
This house is $200000
The change is $-10000
The monthly mortgage is $750