Question: Can you please help me with this python question. 1.5) The TidBit Computer Store has a credit plan for computer purchases. There is a 10%
Can you please help me with this python question.
1.5) The TidBit Computer Store has a credit plan for computer purchases. There is 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
An example table is shown below:
| Month | Starting Balance | Interest to Pay | Principle to Pay | Payment | Ending Balance |
|---|---|---|---|---|---|
| 1 | 12.00 | 0.12 | 0.48 | 0.60 | 11.40 |
| 2 | 11.40 | 0.11 | 0.49 | 0.60 | 10.80 |
| 3 | 10.80 | 0.11 | 0.49 | 0.60 | 10.20 |
It is important that your output follow the format in the table above.
Here are some usual facts:
Input
- purchase price
Constants
- annual interest rate = 12%
- downpayment = 10% of purchase price
- monthly payment = 5% of purchase price
The amount of principal for a month is equal to the monthly payment minus the interest owed.
# Example of code of get start
"""
Program: tidbit.py
Project 1.5
Print a payment schedule for a loan to purchase a computer.
Input
purchase price
Constants
annual interest rate = 12%
downpayment = 10% of purchase price
monthly payment = 5% of purchase price
"""
# Write your code below:
# End of Example of code of get start
# Below is the code which is not right, but does shows out puts. This might help
#constants declaration DOWN_PAYMENT_RATE = 0.10 ANNUAL_INTEREST_RATE = 0.12 MONTHLY_PAYMENTS_RATE = 0.05 #prompt the user to enter the purchase price purchasePrice = float(input("Enter the purchase price: ")) #The month number (beginning with 1) month = 1 #The payment for that month payment = purchasePrice * MONTHLY_PAYMENTS_RATE #The current total balance owed startingBalance = purchasePrice #print the table heading print(" %s%19s%18s%19s%10s%17s" % ("Month", "Starting Balance", "Interest to Pay", "Principal to Pay", "Payment", "Ending Balance")) #repeat the loop as long as the startingBalance is greater than 0 while startingBalance > 0: #The interest owed for that month interestToPay = startingBalance * ANNUAL_INTEREST_RATE / 12 #The amount of principal owed for that month principalToPay = payment - interestToPay #The balance remaining after payment endingBalance = startingBalance - payment #print the statistics print("%2d%16.2f%16.2f%18.2f%18.2f%15.2f" % (month, startingBalance, interestToPay, principalToPay, payment, endingBalance)) #update the starting balance startingBalance = endingBalance #increment the month by 1 month = month + 1
# Feedback i got for above code are:
- Remember to calculate the down payment and deduct it from the starting balance
- In your loop you need to check to see if the remaining balance to be paid is actually less than the monthly payment. If it is then the payment is balance, and the interest is 0. If it's still greater than the monthly payment, then you need to calculate the interest to pay.
- the remaining balance will be the current balance minus the principal
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
