Due: January 18 at 11:55pm
Points: 100
If you have not already taken out a loan, you undoubtedly will some time in your life. For example, when you buy a house, the “mortgage” you pay is simply payment on the amount that the mortgage holder has loaned you. If you have a loan to pay your school bills, at some point you will have to repay it. This program will help you figure out how much you will need to pay per month, assuming the loan is a standard one.
Three quantities define how much a borrower has to pay per month:
We are interested in two values: the monthly payment P, and how much principle RP remains each month.
The formula for the monthly payment, which does not change throughout the repaying of the loan is:
The amount of principle that is left to be repaid after m months is:
Input. This program takes no input.
Output. Your program’s output should look exactly like this:
Payment schedule for a loan of $5000.00 at 6.5% interest, repaid over 1 year:
month payment remaining
1 431.48 4595.60
2 431.48 4189.01
3 431.48 3780.22
4 431.48 3369.21
5 431.48 2955.98
6 431.48 2540.51
7 431.48 2122.79
8 431.48 1702.81
9 431.48 1280.55
10 431.48 856.00
11 431.48 429.16
12 431.48 0.00
The print statement for the lines after the first is:
print(" %3d %7.2f %9.2f" % (m, P, RP))where m is the number of the payment and P and RP are as above.
Submit. Name your program “loan1.py” and submit it to the Homework 1 area for this class on Canvas.
Input. The sequence of prompts for your program must exactly match the following (the red text is what you type):
What is the annual interest rate (enter it without the % sign)? 6.5
How much is being borrowed (no commas)? 5000
How many years is the loan for? 1
Output. The output of your program must look exactly like this:
Payment schedule for a loan of $5000.00 at 6.5% interest, repaid over 1 year:
month payment remaining
1 431.48 4595.60
2 431.48 4189.01
3 431.48 3780.22
4 431.48 3369.21
5 431.48 2955.98
6 431.48 2540.51
7 431.48 2122.79
8 431.48 1702.81
9 431.48 1280.55
10 431.48 856.00
11 431.48 429.16
12 431.48 0.00
Submit. Name your program “loan2.py” and submit it to the Homework 1 area for this class on SmartSite.
|
Last modified: Version of January 5, 2019 at 12:09AM Winter Quarter 2019 You can get a PDF version of this |