Suppose that the Loan class is given as shown in the following UML. Write a test
ID: 3786112 • Letter: S
Question
Suppose that the Loan class is given as shown in the following UML. Write a test program to perform the following tasks. Create a Loan object with loan amount $100000, annual interest rate 3.5%, and number of years 15. Change the annual interest rate to 5.5%, and the number of years to 30. Displays the monthly payment and total payment. The annual interest rate of the loan (default: 2.5). The number of years for the loan (default: 1) The loan amount (default: 1000).. The date this loan was created. Constructs a default loan object. Constructs a loan with specified interest rate, years, and loan amount. Returns the annual interest rate of this loan. Returns the number of the years of this loan. Returns the amount of this loan. Returns the date of the creation of this loan. Sets a new annual interest rate to this loan. Sets a new number of years to this loan. Sets a new amount to this loan. Returns the monthly payment of this loan Returns the total payment of this loanExplanation / Answer
#include #include using namespace std; class Student_Loan{ public: doubel amount; double calculate_monthly_payment(double principle,double years,double rate){ double monthly_pay; amount = principle * (pow((1 + rate / 100), years) ); monthly_pay = amount / (years*12.0); return monthly_pay; } }; int main() { // your code goes here float principle, rate, time_years; Student_Loan b; // Read principle, time and rate coutRelated Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.