identify at least four noncomment related improvements that

identify at least four (non-comment related) improvements that could be made, describing how the change would be an improvement. IN C++

Solution

// Mortgage Payment Calculator program
// This program determines the monthly payments on a
// mortgage given the loan amount, the yearly interest,
// and the number of years.
//***************************************************
#include <iostream> // Access cout
#include <cmath> // Access power function
#include <iomanip> // Access manipulators

using namespace std;

int main()
{
// Amount of loan
float loan_amount;
// Yearly interest
float yearly_interest;
// Monthly interest rate
float monthlyInterest;
// Monthly payment
float payment;
// Number of years
int number_of_years;
// Total number of payments
int numberOfPayments;

//Accept data from user
cout<<\"\ Enter Amount of loan: \";
cin>>loan_amount;
cout<<\"\ Enter yearly interest rate: \";
cin>>yearly_interest;
cout<<\"\ Enter time period: \";
cin>>number_of_years;

// Calculate values
monthlyInterest = yearly_interest / 12;
numberOfPayments = number_of_years * 12;
payment =(loan_amount * pow(monthlyInterest + 1, numberOfPayments) * monthlyInterest)/(pow(monthlyInterest + 1, numberOfPayments) - 1);

// Output results
cout << fixed << setprecision(2)
<< \"For a loan amount of \"
<< loan_amount << \" with an interest rate of \"
<< yearly_interest << \" and a \"
<< number_of_years
<< \" year mortgage, \" << endl;

cout << \" your monthly payments are $\" << payment
<< \".\" << endl;

return 0;
}

Output:

Enter Amount of loan: 1000

Enter yearly interest rate: 10

Enter time period: 3
For a loan amount of 1000.00 with an interest rate of 10.00 and a 3 year mortgage,
your monthly payments are $833.33.

identify at least four (non-comment related) improvements that could be made, describing how the change would be an improvement. IN C++Solution// Mortgage Payme
identify at least four (non-comment related) improvements that could be made, describing how the change would be an improvement. IN C++Solution// Mortgage Payme

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site