Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Suppose you buy a car and you are making monthly payments. Two years later, you discover you need to trade it in for a

Python

Suppose you buy a car and you are making monthly payments. Two years later, you discover you need to trade it in for a minivan. How much do you still owe on your car?

The answer to a question like this is found by creating something called an "amortization table" for the loan. This is just a table that shows for each payment, how much went to pay interest, how much went towards paying off what you owe, called the principal, and how much you still owe, called the balance.

Let's start with a small concrete example. Suppose you borrow $100 at an interest rate of 10% per month, and you make monthly payments of $30. A month goes by, and you make your first payment. After that, how much do you owe?

Look at the table below to see how the monthly payments apply to the loan:

Loan Amount: $ 100.00 APR: 10.00% Payment: 30.00 Month (#) Interest ($) Principle ($) Balance ($) 1 0.83 29.17 70.83 2 0.59 29.41 41.42 3 0.35 29.65 11.77 Final Payment 0.10 11.77 0

Write a script that takes a loan amount, an annual percentage rate (APR) and monthly payment and prints a loan table.

# Sample input/output Enter loan amount: 100 Enter annual rate (%): 10 Enter monthly payment: 30 Loan Amount: $ 100.00 APR: 10.00% Payment: 30.00 Month (#) Interest ($) Principle ($) Balance ($) 1 0.83 29.17 70.83 2 0.59 29.41 41.42 3 0.35 29.65 11.77 Final Payment 0.10 11.77 0

Here are a few hints on performing the calculations:

Look at the table to find the calculations we did over and over again:

  1. What is the repeated action?
    calculate the interest # interest = balance * monthly_rate calculate the principal calculate the new balance print one line of the table
  2. How do we start out?

    Initially the balance is the original borrowed amount. Compute the monthly rate. The statements from the first step represent the statements to repeat.

  3. How do we know whether to keep doing it?Your program should print the table very close to what you see in the sample
  4. Looking at the sample above, we knew it was the end when the final payment of $11.87 (Principle of $11.77 plus Interest of $0.10) which was less than the monthly payment.
  5. Tables need to be formatted as shown

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Theory And Application Bio Science And Bio Technology International Conferences DTA And BSBT 2011 Held As Part Of The Future Generation In Computer And Information Science 258

Authors: Tai-hoon Kim ,Hojjat Adeli ,Alfredo Cuzzocrea ,Tughrul Arslan ,Yanchun Zhang ,Jianhua Ma ,Kyo-il Chung ,Siti Mariyam ,Xiaofeng Song

2011th Edition

3642271561, 978-3642271564

Students also viewed these Databases questions