You are to write a program to tell you how many months it will take to pay off a loan, as well as the total amount of interest paid over the life of the loan.

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
100%

You are to write a program to tell you how many months it will take to pay off a loan, as well as the total amount of interest paid over the life of the loan.

 

You have just purchased a stereo system that costs $1000 on the following credit plan:  No down payment, an interest rate of 18% per year (and hence 1.5% per month), and monthly payments of $50.  The monthly payment of $50 is used to pay the interest and whatever is left is used to pay part of the remaining debt.  Hence, the first month you pay 1.5% of $1000 in interest.  That is $15 in interest. So, the remaining $35 is deducted from your debt which leaves you with a debt of $965.00.  The next month you pay interest of 1.5% of $965.00, which is $14.48. Hence, you can deduct $35.52 (which is $50 - $14.48) from the amount you owe. 

 

Write a program that will tell you how many months it will take you to pay off the loan, as well as the total amount of interest paid over the life of the loan.  Use a loop to calculate the amount of interest and the size of the debt after each month.  Put out the monthly amount of interest paid and remaining debt.  Use a variable to count the number of loop iterations and hence the number of months until the debt is zero.  You may want to use other variables as well. 

A sample session may run as follows:

Enter the amount of the loan                           1000.00

Enter the yearly interest rate                           18.0

Enter the monthly amount paid                      50.00

 

Month                  Principle              Interest                 Principle              Remaining

Paid                      Paid                      Balance

              

1                            1000.00                15.00                    35.00                    965.00

2                            965.00                 14.48                    35.52                    929.48

3                            929.48                 13.94                    36.06                    893.42

.

.

24                             47.12                   0.71                    49.29                    -2.17

 

Number of months to pay of the loan:           24

Total interest paid on loan:                             197.83

You have a credit of:                                       -2.17

 

 

how would I do this in c++

 

Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 2 steps

Blurred answer
Knowledge Booster
Random Class and its operations
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.
Similar questions
  • SEE MORE QUESTIONS
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