Inputs of mortgage calculator that determines a monthly payment for loans and produces an amortization schedule for the life of the loan(10-15-20) years fixed loan with 4.5% interest rate and Principal 100000$. The program should initially prompt the user for 1) the principal of the loan. 2)It should then ask him or her to enter an annual interest rate for the loan. 3)The final input should be the number of years that the loan will be outstanding. Because the company only offers three different terms (10-, 15-, and 30-year loans), the program should ensure that no other terms are entered. P = $100,000 r = 4.50% per year / 12 months = 0.375% (or 0.00375) per period n = 15 years * 12 months = 180 total periods A = 100,000 * (.00375 * (1 + .00375)180)/((1+.00375)180 – 1) Using these numbers in the formula above yields a monthly payment of $764.99. Amortization schedule: The Interest portion of the payment is calculated as the rate (r) times the previous balance and should be rounded to the nearest cent. The Principal portion of the payment is calculated as Amount - Interest. The new Balance is calculated by subtracting the Principal from the previous balance. The last payment amount may need to be adjusted (as in the table below) to account for the rounding. The amortization schedule for the example above is presented here: Note that the first and last three rows are listed here so that you can see the beginning and end of the report. In your program, you must include all of the rows in your output. Once the inputs have been entered and validated, your program must calculate the monthly payment for the loan. you must create a function called CalcPayment that receives the principal, interest rate, and number of years as parameters. The function should return the monthly payment that is calculated. In main(), using the monthly payment that you just calculated, call a function to create an amortization schedule for the loan using these specifications: Create a function called Amortize. It should receive as parameters: currentPeriod, totalPeriods, paymentAmount, monthlyInterestRate, currentBalance. Your program should check for invalid data such as non-numeric and non-positive entries for principal, interest rate, and term. Therefore, you may use the following code to determine if a non-numeric or negative number has been entered: int num; cout << "Enter an integer: " << endl; cin >> num; while (cin.fail() || num < 0) { cout << "You must enter a number, and that number must be positive. Please try again. " << endl; cin.clear(); cin.ignore(numeric_limits::max(),'\n'); cin >> num; } this is how the output should be: (the output should be ONLY principal, rate and number of years . THe rest and Monthly payment should be calculated automatically by the program)
Max Function
Statistical function is of many categories. One of them is a MAX function. The MAX function returns the largest value from the list of arguments passed to it. MAX function always ignores the empty cells when performing the calculation.
Power Function
A power function is a type of single-term function. Its definition states that it is a variable containing a base value raised to a constant value acting as an exponent. This variable may also have a coefficient. For instance, the area of a circle can be given as:
Inputs of mortgage calculator that determines a monthly payment for loans and produces an amortization schedule for the life of the loan(10-15-20) years fixed loan with 4.5% interest rate and Principal 100000$.
The program should initially prompt the user for
1) the principal of the loan. 2)It should then ask him or her to enter an annual interest rate for the loan. 3)The final input should be the number of years that the loan will be outstanding. Because the company only offers three different terms (10-, 15-, and 30-year loans), the program should ensure that no other terms are entered.
P = $100,000
r = 4.50% per year / 12 months = 0.375% (or 0.00375) per period
n = 15 years * 12 months = 180 total periods
A = 100,000 * (.00375 * (1 + .00375)180)/((1+.00375)180 – 1)
Using these numbers in the formula above yields a monthly payment of $764.99.
Amortization schedule:
The Interest portion of the payment is calculated as the rate (r) times the previous balance and should be rounded to the nearest cent. The Principal portion of the payment is calculated as Amount - Interest. The new Balance is calculated by subtracting the Principal from the previous balance. The last payment amount may need to be adjusted (as in the table below) to account for the rounding.
The amortization schedule for the example above is presented here: Note that the first and last three rows are listed here so that you can see the beginning and end of the report. In your program, you must include all of the rows in your output.
- Once the inputs have been entered and validated, your program must calculate the monthly payment for the loan. you must create a function called CalcPayment that receives the principal, interest rate, and number of years as parameters. The function should return the monthly payment that is calculated.
- In main(), using the monthly payment that you just calculated, call a function to create an amortization schedule for the loan using these specifications:
- Create a function called Amortize. It should receive as parameters: currentPeriod, totalPeriods, paymentAmount, monthlyInterestRate, currentBalance.
- Your program should check for invalid data such as non-numeric and non-positive entries for principal, interest rate, and term.
Therefore, you may use the following code to determine if a non-numeric or negative number has been entered:
int num;
cout << "Enter an integer: " << endl;
cin >> num;
while (cin.fail() || num < 0)
{
cout << "You must enter a number, and that number must be positive. Please try again. " << endl;
cin.clear();
cin.ignore(numeric_limits<streamsize>::max(),'\n');
cin >> num; }
this is how the output should be: (the output should be ONLY principal, rate and number of years . THe rest and Monthly payment should be calculated automatically by the program)
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 5 images