Instructions Design a class that will determine the monthly payment on a home mortgage.  The monthly payment with interest compounded monthly can be calculated as follows: (See image) The class should have member functions for setting the loan amount, interest rate, and number of years of the loan.  If should also have member functions for returning the monthly payment amount and the total amount paid to the bank at the end of the loan period.  Implement the class in a complete program as shown in the sample run below. You must have a comment block header at the top of your program.  You MUST use a class for the Mortgage.  You should have 3 files: Mortgage.h, Mortgage.cpp, project4.cpp like we did in class. You must have private/public members You must have a constructor that initializes all members to 0 You must have a mutator function for the loan amount, rate and years You must have accessor functions for the monthly payment and pay back amounts  You need a menu to ask for a new loan or exit the program You must use the correct data types for your variables You must validate your input.   The loan should be > 0 The interest rate should be >= 0 The length in years should be between 1 and 30 years Your main program should have 2 functions showPayment that takes one argument of type Mortgage as a pointer and displays the monthly payment and total payback getLoan that takes no arguments but returns one object of type Mortgate Your output should be formatted correctly   Sample Run #1: ------------------------ 1. Enter a new loan 2. Exit program Enter your choice: 1 Enter the amount of the loan: 250000 Enter the annual interest rate in decimal form (example .075): -1 Interest rate must be greater than 0. Please re-enter: .075 Enter the length of the loan in years: 50 Years must be greater than 0 and less than 30. Please re-enter: 30 ======================== Monthly Payment: $1748.04 Total Pay Back: $629293.06 ======================== ------------------------ 1. Enter a new loan 2. Exit program Enter your choice: 2

Database System Concepts
7th Edition
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Chapter1: Introduction
Section: Chapter Questions
Problem 1PE
icon
Related questions
Question
Instructions
Design a class that will determine the monthly payment on a home mortgage.  The monthly payment with interest compounded monthly can be calculated as follows: (See image)

The class should have member functions for setting the loan amount, interest rate, and number of years of the loan.  If should also have member functions for returning the monthly payment amount and the total amount paid to the bank at the end of the loan period.  Implement the class in a complete program as shown in the sample run below.

  • You must have a comment block header at the top of your program. 
  • You MUST use a class for the Mortgage.  You should have 3 files: Mortgage.h, Mortgage.cpp, project4.cpp like we did in class.
    • You must have private/public members
    • You must have a constructor that initializes all members to 0
    • You must have a mutator function for the loan amount, rate and years
    • You must have accessor functions for the monthly payment and pay back amounts 
  • You need a menu to ask for a new loan or exit the program
  • You must use the correct data types for your variables
  • You must validate your input.  
    • The loan should be > 0
    • The interest rate should be >= 0
    • The length in years should be between 1 and 30 years
  • Your main program should have 2 functions
    • showPayment that takes one argument of type Mortgage as a pointer and displays the monthly payment and total payback
    • getLoan that takes no arguments but returns one object of type Mortgate
  • Your output should be formatted correctly
 
Sample Run #1:
------------------------
1. Enter a new loan
2. Exit program
Enter your choice: 1
Enter the amount of the loan: 250000
Enter the annual interest rate in decimal form (example .075): -1
Interest rate must be greater than 0. Please re-enter: .075
Enter the length of the loan in years: 50
Years must be greater than 0 and less than 30. Please re-enter: 30
========================
Monthly Payment: $1748.04
Total Pay Back: $629293.06
========================
------------------------
1. Enter a new loan
2. Exit program
Enter your choice: 2
Rate
12
Term 1
Loan X
Payment
Where
Term = (1 +
x Term
Rate 12 x Years
-)
12
Payment = the monthly payment
Loan = the dollar amount of the loan
Rate = the annual interest rate
Years = the number of years of the loan
Transcribed Image Text:Rate 12 Term 1 Loan X Payment Where Term = (1 + x Term Rate 12 x Years -) 12 Payment = the monthly payment Loan = the dollar amount of the loan Rate = the annual interest rate Years = the number of years of the loan
Expert Solution
steps

Step by step

Solved in 5 steps with 5 images

Blurred answer
Knowledge Booster
Data members
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.
Similar questions
  • SEE MORE QUESTIONS
Recommended textbooks for you
Database System Concepts
Database System Concepts
Computer Science
ISBN:
9780078022159
Author:
Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:
McGraw-Hill Education
Starting Out with Python (4th Edition)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education