Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Suppose that $ 1 0 0 0 is borrowed at the beginning of the year. The loan is charged interest at an annual interest rate

Suppose that $1000 is borrowed at the beginning of the year. The loan is charged interest at an annual interest rate of 5%.
The borrower will repay the loan by making payments of $150 at the end of the year until the loan is repaid. Note that
when the final payment is made, the balance will be less than $150, and so a partial payment will be made at that time.
Perform the following steps in a single code cell.
Create variables named balance, i and pmt to store the initial loan amount, annual interest rate, and annual
payment amount mentioned in the paragraph above. Also create a variable n to track the number of payments.
Use a while loop to perform the tasks described below. The loop should continue to execute for as long as the
balance of the loan is greater than 0.
Increase the number of payments that have been made by 1.
Calculate the new balance. This will be done by multiplying the current balance by 1+i, and then
subtracting the payment amount. Store the result back into balance, rounded to 2 decimal places.
If the new balance is less than 0, then calculate the the final payment amount. This will be equal to the
new balance plus the payment amount. Then set the balance to 0.
Print the message below, with the Xxxx symbols replaced with the appropriate values. Match the
format exactly.
The balance at the end of year xxxx is $xxxx.
The first two lines of output should appear as shown below:
The balance at the end of year 1 is $900.00.
The balance at the end of year 2 is $795.00.
No lists should be created for this problem, and only one loop should be used.
Use a new code cell to print the final payment amount with a message as shown below:
The amount of the final payment will be $.
image text in transcribed

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

Students also viewed these Databases questions