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
icon
Related questions
Question

Please solve using C++. 

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.
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
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps with 5 images

Blurred answer
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
Bartleby Expert
SEE SOLUTION
Follow-up Question

Can you please divide this code into 3 section

Loan.h

Loan.cpp and 

main

Solution
Bartleby Expert
SEE SOLUTION
Knowledge Booster
Software Development
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
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)
Starting Out with Python (4th Edition)
Computer Science
ISBN:
9780134444321
Author:
Tony Gaddis
Publisher:
PEARSON
Digital Fundamentals (11th Edition)
Digital Fundamentals (11th Edition)
Computer Science
ISBN:
9780132737968
Author:
Thomas L. Floyd
Publisher:
PEARSON
C How to Program (8th Edition)
C How to Program (8th Edition)
Computer Science
ISBN:
9780133976892
Author:
Paul J. Deitel, Harvey Deitel
Publisher:
PEARSON
Database Systems: Design, Implementation, & Manag…
Database Systems: Design, Implementation, & Manag…
Computer Science
ISBN:
9781337627900
Author:
Carlos Coronel, Steven Morris
Publisher:
Cengage Learning
Programmable Logic Controllers
Programmable Logic Controllers
Computer Science
ISBN:
9780073373843
Author:
Frank D. Petruzella
Publisher:
McGraw-Hill Education