Question
3. C++ Programming: Please use LOOP only, and also provide detailed comments for everything that is included in the code. Please look at both examples
3. C++ Programming: Please use LOOP only, and also provide detailed comments for everything that is included in the code. Please look at both examples for this question to understand what to do. Thank you very much.
Question 3: (Please use LOOP only) The UBANK bank grants a loan only if the total amount of interest it can collect is greater than $30,000 and the term of the loan is less than or equal to 20 years. To answer to this strict policy, you must write a C++ program (use LOOP only) that takes as input the sum you want to borrow and the bank's annual interest rate. The program must then calculate the number of years necessary for the accumulated interest that the bank can collect exceeds $30,000. In case the number of years exceeds 20 years, the loan is denied.
The program must display the number of years required as well as the details of the accrued interest and the total amount the borrower will have to repay to the bank (see examples). It is clear that each year, the interest is calculated on the new amount. So for a loan of 120,000 dollars at 7%, we will have:
First year: interest=12000*0.07=8400
Second year interest=(128400)*0.07=8988
Second year interest=(137388)*0.07=9617.16
Etc
Example 1:
Enter the amount that you want to borrow: 120000
Enter the annual interest rate: 7
Year 1: annual interest = 8400.00: accrued interest = 8400.00, total amount to repay = 128400.00
Year 2: annual interest = 8988.00: accrued interest = 17388.00, total amount to repay = 137388.00
Year 3: annual interest = 9617.16: accrued interest = 27005.16, total amount to repay = 147005.16
Year 4: annual interest = 10290.36: accrued interest = 37295.52, total amount to repay = 157295.52
The loan is accepted. The interest accrued over 4 years will be 37295.52 dollars.
Example 2:
Enter the amount that you want to borrow: 30000
Enter the annual interest rate: 2
Year 1: annual interest = 600.00: accrued interest = 600.00, total amount to repay = 30600.00
Year 2: annual interest = 612.00: accrued interest = 1212.00, total amount to repay = 31212.00
Year 3: annual interest = 624.24: accrued interest = 1836.24, total amount to repay = 31836.24
Year 4: annual interest = 636.72: accrued interest = 2472.96, total amount to repay = 32472.96
Year 5: annual interest = 649.46: accrued interest = 3122.42, total amount to repay = 33122.42
Year 6: annual interest = 662.45: accrued interest = 3784.87, total amount to repay = 33784.87
Year 7: annual interest = 675.70: accrued interest = 4460.57, total amount to repay = 34460.57
Year 8: annual interest = 689.21: accrued interest = 5149.78, total amount to repay = 35149.78
Year 9: annual interest = 703.00: accrued interest = 5852.78, total amount to repay = 35852.78
Year 10: annual interest = 717.06: accrued interest = 6569.83, total amount to repay = 36569.83
Year 11: annual interest = 731.40: accrued interest = 7301.23, total amount to repay = 37301.23
Year 12: annual interest = 746.02: accrued interest = 8047.25, total amount to repay = 38047.25
Year 13: annual interest = 760.95: accrued interest = 8808.20, total amount to repay = 38808.20
Year 14: annual interest = 776.16: accrued interest = 9584.36, total amount to repay = 39584.36
Year 15: annual interest = 791.69: accrued interest = 10376.05, total amount to repay = 40376.05
Year 16: annual interest = 807.52: accrued interest = 11183.57, total amount to repay = 41183.57
Year 17: annual interest = 823.67: accrued interest = 12007.24, total amount to repay = 42007.24
Year 18: annual interest = 840.14: accrued interest = 12847.39, total amount to repay = 42847.39
Year 19: annual interest = 856.95: accrued interest = 13704.34, total amount to repay = 43704.34
Year 20: annual interest = 874.09: accrued interest = 14578.42, total amount to repay = 44578.42
Loan is denied. The interest rate accrued over 20 years is 14578.42 dollars
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started