Loan Application - Amortization Schedule Principal: Life of Loan (10, 15 or 30 years): Annual interest rate: Monthly payment: 100000 15 4.5% 764.99 Payment Amount Interest Principal Balance 100000.00 764.99 375.00 389.99 99610.01 2 764.99 373.54 391.46 99218.55 3 764.99 372.07 392.92 98825.63 178 764.99 8.54 756.45 1521.42 179 764.99 5.71 759.29 762.14 180 764.99 2.86 762.14 e.00 Press any key to continue

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question

Instructions

You are working as a computer programmer for a mortgage company that provides loans to consumers for residential housing.  Your task is to create an application to be used by the loan officers of the company when presenting loan options to its customers.  The application will be a mortgage calculator that determines a monthly payment for loans and produces an amortization schedule for the life of the loan.

The company offers 10-, 15-, and 30-year fixed loans. 

Inputs

The program should initially prompt the user (the loan officer) for the principal of the loan (i.e. the amount that is being borrowed). 

It should then ask him or her to enter an annual interest rate for the loan.

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.

Payment Calculator

The formula to calculate the monthly payment for a fixed interest rate loan is as follows: A=P[(1+r)^n]/[(1+r)^n-1]

Example: What would the monthly payment be on a 15-year, $100,000 loan with a 4.50% annual interest rate?

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.

Requirements:

  1. Start your program by prompting the user to enter a principal amount.  The data type of this number should be a double.  The amount must be positive and it must also be a numeric value. 
  2. Prompt the user to enter an annual interest rate for the loan as a percent.  For example, an annual interest rate of 4.5% should be entered as 4.5.  Your program will convert it to .045 for calculations.If a non-numeric or negative interest rate is entered, prompt the user to re-enter the rate.
  3. Prompt the user to enter the term of the loan.  Valid terms are 10, 15, and 30 years.  Any other entries should be rejected, and the user should be prompted to re-enter an appropriate value.
  4. 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.
  5. In main(), using the monthly payment that you just calculated, call a function to create an amortization schedule for the loan using these specifications: 
    1. Create a function called Amortize.  It should receive as parameters: currentPeriod, totalPeriods, paymentAmount, monthlyInterestRate, currentBalance.
    2. The function MUST be recursive to receive credit for producing the Amortization Schedule.
    3. The function should print out the Amortization Schedule to the screen using good formatting (including spelling and grammar where appropriate)

 

Your program should check for invalid data such as non-numeric and non-positive entries for principal, interest rate, and term.

General notes about error checking

As in all applications, you should design your code to be robust enough to handle anything that a user may enter.  In this program, you will prompt the user to enter three numbers:  a principal amount, an interest rate, and a number of years (i.e. term).  Because users can make mistakes, you need to make sure that they enter numbers for these inputs (as opposed letters or other characters) and that any numbers entered are reasonable

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;

       }

the output is the image

**Loan Application - Amortization Schedule**

- **Principal:** 100,000
- **Life of Loan (10, 15 or 30 years):** 15
- **Annual Interest Rate:** 4.5%
- **Monthly Payment:** 764.99

| Payment | Amount | Interest | Principal | Balance  |
|---------|--------|----------|-----------|----------|
| 1       | 764.99 | 375.00   | 389.99    | 99610.01 |
| 2       | 764.99 | 373.54   | 391.46    | 99218.55 |
| 3       | 764.99 | 372.07   | 392.92    | 98825.63 |
| ...     | ...    | ...      | ...       | ...      |
| 178     | 764.99 | 8.54     | 756.45    | 1521.42  |
| 179     | 764.99 | 5.71     | 759.29    | 762.14   |
| 180     | 764.99 | 2.86     | 762.14    | 0.00     |

**Instructions:**
- Press any key to continue... 

**Explanation:**
The table represents the amortization schedule for a loan, which outlines how each payment is applied towards interest and principal over time. The initial loan balance of 100,000 is gradually reduced to zero over 180 monthly payments (15 years), with each payment remaining constant at 764.99. Interest payments decrease as the principal is paid down.
Transcribed Image Text:**Loan Application - Amortization Schedule** - **Principal:** 100,000 - **Life of Loan (10, 15 or 30 years):** 15 - **Annual Interest Rate:** 4.5% - **Monthly Payment:** 764.99 | Payment | Amount | Interest | Principal | Balance | |---------|--------|----------|-----------|----------| | 1 | 764.99 | 375.00 | 389.99 | 99610.01 | | 2 | 764.99 | 373.54 | 391.46 | 99218.55 | | 3 | 764.99 | 372.07 | 392.92 | 98825.63 | | ... | ... | ... | ... | ... | | 178 | 764.99 | 8.54 | 756.45 | 1521.42 | | 179 | 764.99 | 5.71 | 759.29 | 762.14 | | 180 | 764.99 | 2.86 | 762.14 | 0.00 | **Instructions:** - Press any key to continue... **Explanation:** The table represents the amortization schedule for a loan, which outlines how each payment is applied towards interest and principal over time. The initial loan balance of 100,000 is gradually reduced to zero over 180 monthly payments (15 years), with each payment remaining constant at 764.99. Interest payments decrease as the principal is paid down.
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 8 steps with 5 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY