Transform the following UML diagram to a Loan class: Loan -annualInterestRate: double -numberOfYears: int -loanAmount: d
Posted: Mon May 09, 2022 7:02 am
Transform the following UML diagram to a Loan class: Loan -annualInterestRate: double -numberOfYears: int -loanAmount: double The annual interest rate of the loan (default: 2.5). The number of years for the loan (default: 1) The loan amount (default: 1000). Constructs a default Loan object. Constructs a loan with specified interest rate, years, and loan amount. +Loan) +Loan(annualInterestRate: double, numberOfYears: int, loanAmount: double) +getAnnualInterestRate(): double +getNumberOfYears(): int +getLoanAmount(): double +setAnnualInterestRateſ annualInterestRate: double): void +setNumberOfYears numberOfYears: int): void +set LoanAmount loanAmount: double): void +getMonthlyPayment(): double +getTotalPayment(): double Returns the annual interest rate of this loan. Returns the number of the years of this loan. Returns the amount 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 loan. Your class should include a test driver function main(). This main() should do the following: 1. Read annual interest rate, number of years and the loan amount. 2. Create a Loan object 3. Display the monthly payment and the total payment. Make sure your program is working correctly.