Transform the following UML diagram to a Loan class: Loan |-annualInterestRate: double The annual interest rate of the loan (default: 2.5). |-numberOfYears: int |-loanAmount: double The number of years for the loan (default: 1) The loan amount (default: 1000). +Loan() +Loan(annualInterestRate: double, numberOfYears: int, loanAmount: double) Constructs a default Loan object. Constructs a loan with specified interest rate, years, and loan amount. +getAnnualInterestRate(): double +getNumberOfYears(): int +getLoanAmount(): double +setAnnualInterestRate( annualInterestRate: double): void 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. +setNumberOfYears( numberOfYears: int): void Sets a new number of years to this loan. +setLoanAmount( loanAmount: double): void Sets a new amount to this loan. +getMonthlyPayment(): double Returns the monthly payment of this loan. +getTotalPayment(): double 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.
Transform the following UML diagram to a Loan class: Loan |-annualInterestRate: double The annual interest rate of the loan (default: 2.5). |-numberOfYears: int |-loanAmount: double The number of years for the loan (default: 1) The loan amount (default: 1000). +Loan() +Loan(annualInterestRate: double, numberOfYears: int, loanAmount: double) Constructs a default Loan object. Constructs a loan with specified interest rate, years, and loan amount. +getAnnualInterestRate(): double +getNumberOfYears(): int +getLoanAmount(): double +setAnnualInterestRate( annualInterestRate: double): void 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. +setNumberOfYears( numberOfYears: int): void Sets a new number of years to this loan. +setLoanAmount( loanAmount: double): void Sets a new amount to this loan. +getMonthlyPayment(): double Returns the monthly payment of this loan. +getTotalPayment(): double 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.
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
Related questions
Question
Please solve using C++.

Transcribed Image Text:Transform the following UML diagram to a Loan class:
Loan
|-annualInterestRate: double
The annual interest rate of the loan (default: 2.5).
-numberOfYears: int
The number of years for the loan (default: 1)
-loanAmount: double
The loan amount (default: 1000).
|+Loan()
|+Loan(annualInterestRate: double,
numberOfY ears: int,
loanAmount: double)
Constructs a default Loan object.
Constructs a loan with specified interest rate, years, and
loan amount.
|+getAnnualInterestRate(): double
|+getNumberOfYears(): int
|+getLoanAmount(): double
|+setAnnualInterestRate(
annualInterestRate: double): void
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.
+setNumberOfYears(
numberOfYears: int): void
Sets a new number of years to this loan.
+setLoanAmount(
loanAmount: double): void
Sets a new amount to this loan.
+getMonthlyPayment(): double
Returns the monthly payment of this loan.
+getTotalPayment(): double
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.
Expert Solution

This question has been solved!
Explore an expertly crafted, step-by-step solution for a thorough understanding of key concepts.
This is a popular solution!
Trending now
This is a popular solution!
Step by step
Solved in 2 steps with 5 images

Follow-up Questions
Read through expert solutions to related follow-up questions below.
Follow-up Question
Can you please break the above code into 3 sections (loan.h, loan.cpp and main.cpp and give me the output please.
Solution
Follow-up Question
Can you please divide this code into 3 section
Loan.h
Loan.cpp and
main
Solution
Knowledge Booster
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.Recommended textbooks for you

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

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)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON

Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON

C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON

Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning

Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education