Answer:
Here is code in c++.
#include <bits/stdc++.h>
using namespace std;
//main function
int main() {
// variables to store input and calculate price change and mortgage
int current_price,last_price,change;
float mortgage=0;
cout<<"Please enter the current month price:";
//reading current month price
cin>>current_price;
cout<<"Please enter the last month price:";
//reading last month price
cin>>last_price;
// calculating difference
change=current_price-last_price;
// calculating mortgage
mortgage=(current_price*0.045)/12;
//printing output
cout<<"The change is $"<<change<<" since last month."<<endl;
cout<<"The estimated monthly mortgage is $"<<mortgage<<endl;
return 0;
}
Explanation:
Read the current month price and assign it to "current_price" and last month
price to variable "last_price". Calculate change from last month by subtracting
current_price-last_price.And then calculate monthly mortgage as (current_price*0.045)/12. Then print the output.
Output:
Please enter the current price:200000
Please enter the last month price:210000
The change is $-10000 since last month.
The estimated monthly mortgage is $750