Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Practice while loop and formatted output. The Computer Depot has a financing pla

ID: 3668403 • Letter: P

Question

Practice while loop and formatted output. The Computer Depot has a financing 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. For example, if the purchase price is $1000, then monthly payment is $45 for every month. Write a program to display a table of payment schedule for the lifetime of the loan The program prompts users to enter the purchase price. The output of the program is a payment schedule table, with appropriate headers. Each row of the table should contain the following items: The month number (beginning with 1) The current balance (before payment for that month) The interest owed for that month The payment for that month The balance remaining after payment The balance (before payment) in the first month is the purchase price minus down payment. The amount of interest for a month is equal to balance * rate /12. For example, if the purchase price is $1000, then for the first month, The current balance (before payment for that month) is $900 The interest owed for that month is $9 The payment for that month is $45 The balance remaining after payment is $864 User interface specifications: Input The program prompts users to enter the purchase price. Output The payment schedule table shall have appropriate headers. Each column of the table must be aligned. All money amounts are rounded to two decimal places. For example, 37.777779 should be rounded to 37.78.

Explanation / Answer

import decimal def main(): principle = decimal.Decimal(raw_input('Please enter your loan amount:')) rate = decimal.Decimal(raw_input('Please enter rate of interest (percent):')) / 100 term = decimal.Decimal(raw_input('Please enter loan period (years):')) * 12 interest = (principle * rate).quantize(decimal.Decimal('.01'), rounding=decimal.ROUND_HALF_EVEN) balance = principle + interest payment = (balance / term).quantize(decimal.Decimal('.01'), rounding=decimal.ROUND_CEILING) print "Payment Amount Paid Rem.Bal." for count in range(1+term): if count == 0: print count, " 0.00 ", balance elif count == term: # last payment? payment = balance balance -= payment print count, " ", payment, " ", balance else: balance -= payment print count, " ", payment, " ", balance main()

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote