PYTHON The credit plan at TidBit Computer Store specifies a 10% down payment and
ID: 3920538 • Letter: P
Question
PYTHON
The credit plan at TidBit Computer Store specifies a 10% down payment and an annual interest rate of 12%. Monthly payments are 5% of the listed purchase price, minus the down payment.
Write a program that takes the purchase price as input. The program should display a table, with appropriate headers, of a payment schedule for the lifetime of the loan. Each row of the table should contain the following items:
The month number (beginning with 1)
The current total balance owed
The interest owed for that month
The amount of principal owed for that month
The payment for that month
The balance remaining after payment
The amount of interest for a month is equal to balance × rate / 12.
The amount of principal for a month is equal to the monthly payment minus the interest owed.
An example of the program input and output is shown below:
Programming Exercise 3.10 Enter the puchase price: 200 Nonth Starting Balance Interest to Pay Principal to Pay Payment Ending Balance 200-00 198 , ?? 180.00 170.00 168 . ?? 150.00 140.00 130.00 120.00 110.00 2.88 1.90 8.00 8.10 8.20 8.30 8,40 8.50 8.60 8.7 8.80 8.90 9.00 9.10 9.20 9.30 9.40 9.50 9.60 9.70 9.80 9.90 10.00 10.00 10.00 10.00 10.00 10.00 10.00 18·88 10.00 10.00 18 . ?? 10.00 10.00 190.00 170.00 160.00 150.00 140.00 130.00 120.00 110.00 100.00 98.00 80.00 70.00 60.00 50.00 40.00 1.70 1.60 1.30 1.20 1.10 1.00 0.90 0.8? ?.78 0.60 0.50 ?.40 0.30 0-29 ?.10 12 13 14 15 90.00 80.00 60.00 10.00 10.00 50.00 18 19 20 20.00 10.00 0.00 30.00 10.00 10.00 10.00 20.00Explanation / Answer
ScreenShot
------------------------------------------------------------------
Program
#User input prompt
price=input("Enter the purchase price: ")
#initialize month
month=1
#Set Starting Balnce
StaringBalance=float(price)
#Each month payment
payment=float(price)*.05
#display table headers
print('Month Starting Balance Interest to Pay Principal to Pay Payment Ending Balance')
#loop through to display each month payment details
while StaringBalance>=payment:
#interest=12%/Year
interest=StaringBalance*.01
#principal amount calculation
Principal=payment-interest
#ending Balnace calculation
EndingBalance=StaringBalance-payment
#Display o/p
print('{:<10}'.format(month),'{:<20}'.format(StaringBalance),'{:<20}'.format(round(interest,2)),'{:<10}'.format(Principal),'{:<10}'.format(payment),row_format.format(EndingBalance))
#increment month to get next month
month+=1
#set new Staring Balance
StaringBalance=EndingBalance
--------------------------------------------------------
Output
Enter the purchase price: 200
Month Starting Balance Interest to Pay Principal to Pay Payment Ending Balance
1 200.0 2.0 8.0 10.0 190.0
2 190.0 1.9 8.1 10.0 180.0
3 180.0 1.8 8.2 10.0 170.0
4 170.0 1.7 8.3 10.0 160.0
5 160.0 1.6 8.4 10.0 150.0
6 150.0 1.5 8.5 10.0 140.0
7 140.0 1.4 8.6 10.0 130.0
8 130.0 1.3 8.7 10.0 120.0
9 120.0 1.2 8.8 10.0 110.0
10 110.0 1.1 8.9 10.0 100.0
11 100.0 1.0 9.0 10.0 90.0
12 90.0 0.9 9.1 10.0 80.0
13 80.0 0.8 9.2 10.0 70.0
14 70.0 0.7 9.3 10.0 60.0
15 60.0 0.6 9.4 10.0 50.0
16 50.0 0.5 9.5 10.0 40.0
17 40.0 0.4 9.6 10.0 30.0
18 30.0 0.3 9.7 10.0 20.0
19 20.0 0.2 9.8 10.0 10.0
20 10.0 0.1 9.9 10.0 0.0
Press any key to continue . . .
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.