Design a class that will determine the monthly payment on a home mortgage. The monthly…
- User
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: Payment = 𝐿𝑜𝑎𝑛 × 𝑅𝑎𝑡𝑒 12 × 𝑇𝑒𝑟𝑚 𝑇𝑒𝑟𝑚 ― 1 where Term = (1 + 𝑅𝑎𝑡𝑒 12 ) 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 The class should have member functions for setting the loan amount, interest rate and the number of years of the loan. It 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. Input Validation: Do not accept negative numbers for any of the loan values. Submission Requirements You must submit the program that compiles and runs without any error to receive full points. Don’t forget to put comments in your source code so that the reader can understand your program easily. On the top of each source code file, please don’t forget to put your Name.
- Assistant
Here is an example implementation of the class in C++: