Question: Create a class called Loan that represents a simple bank loan. It should include private members for the loan amount ( principal ) , the

Create a class called "Loan" that represents a simple bank loan.
It should include private members for the loan amount (principal), the loan term (integer in months), and the interest rate (a floating point number).
It should have a constructor for this information and accessors and mutators as well.
All of these members and constructors should prevent non-positive values and give an error message if the class hasn't been properly initialized.
It should be able to calculate the monthly payment based on this formula: Payment =ra1-(1+r)-n where r is the interest rate, a is the loan amount, and n is the number of months of the loan. Return this in a member function.
Sum up all of the monthly payments to compute the entire cost of the loan in another member function (interest + principal).
Subtract the total cost of the loan from the principal for just the interest cost of the loan. Return this in another member function.
Use this class on an example car loan for $45,000 over 6 years at 7.5%.(Remember, to convert years to months or have a member function do that for you e.g set_loanlength_from_years()).
Also use this class on an example home loan of $575,000 over 30 years at 6% and at 4% and note the difference in costs.
Please help with that Assigment for C++ Code that I'm gonna run it in Visual studio.
Subject: Advance Programing Technique.
Create a class called "Loan" that represents a

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!