Question: // This program produces a loan amortization table // for the Central Mountain Credit Union. #include #include #include //Needed for the pow function using namespace
// This program produces a loan amortization table
// for the Central Mountain Credit Union.
#include
#include
#include
using namespace std;
int main()
{
double loan, // Loan amount
rate, // Annual interest rate
moInterestRate, // Monthly interest rate
years, // Years of loan
balance, // Monthly Balance
term, // Used to calculate payment
payment; // Monthly payment
int numPayments; // Number of payments
cout << "Loan amount: $";
cin >> loan;
cout << "Annual interest rate (entered as a decimal): ";
cin >> rate;
cout << "Years of loan: ";
cin >> years;
// Calculate monthly payment
numPayments = static_cast
moInterestRate = rate / 12.0;
term = pow((1 + moInterestRate), numPayments);
payment = (loan * moInterestRate * term) /(term - 1.0);
// Display monthly payment
cout << fixed << showpoint << setprecision (2);
cout << " monthly payment: $" << payment << endl;
// Display report header
cout << endl;
cout << setw(5) << "Month" << setw(10) << "Interest";
cout << setw(10) << "Principal" < cout << "----------------------------------------- "; balance = loan ; // remaining balance starts out as full loan amount // produce a listing for each month for (int month = 1; month <= numPayments; month++) { double moInterest, // Amount of pmt that pays interest principal; // Amount of pmt that lowers the balance // Calulate amount paid for this month's interest and principal moInterest = moInterestRate * balance; // Calculate interest first if (month != numPayments) // If not the final month principal = payment - moInterest; //rest of pmt goes // to principal else // It's the last month so { principal = balance; // pay exact final balance payment = balance + moInterest; } // Calulate new loan balance // Only principal reduces the balance -= principal; // balance, noth the whole pmt // Display this month's payment figures cout << setw(4) << month << setw(10) << moInterest; cout << setw(10) << principal << setw(10) << balance << endl; } cin.get(); cin.get(); return 0; } required******************** Central Mountain Credit Union Case Study Assume that a loan has been given to buy a house, and in the amount of $80,000.00, and to be paid in 3 years The escrow amount is computed annually as the addition of real_estate_taxes plus the house_insurance for that year. annual_escrow = real_estate_taxes + house_insurance You must get the real_estate _taxes and the house_insurance amounts from the user (read in data). Provide (display) the appropriate cout message, before the appropriate cin statement such that it will let you know what information to enter. (Example: Real estate taxes may be in the amount $3,000.00 per year, and house insurance may be in the amount of $875.00 per year) Also observe that real_estate_taxes increase every year, let us say three and a half percent (3.5%), and house _insurance also increases every year, say one and a half percent (1.5%) per year. Then use the information given in (b) to get the monthly escrow amount that must be added to the mortgage payment. Remember, mortgage payment is a monthly payment. Observe, that a new annual_escrow amount and a new mortgage amount must be computed every year. (consider using a modular % to help with this) In addition to the display already given in your text book for this program, you must also display as part of the output the monthly amount of real_estate_taxes and the house_insurance part of your escrow. This information must be displayed between Principle and the Balance. The output MUST look like the following: Year# =? Mortgage amount =? Month interest principle estate taxes insurance balance
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
