To model repayment of a loan, you need to calculate the interest on the balance and...

70.2K

Verified Solution

Question

Programming

To model repayment of a loan, you need to calculate the intereston the balance and deduct any payments made. So if the balance atthe start of the period is L the balance at the end of the periodbefore the payment is L(1+r) where r is the interest rate perperiod (e.g. if the payments are monthly, it is a monthly interestrate) and the balance after the payment is L(1+r)−P where P is thepayment per period (e.g. monthly payment). That is the startingbalance for the next period which uses the same formula for thenext payment. Create a Python program that will allow a user tocalculate the amount of a loan after a specified number of monthlypayments. Specifically, the program should:

  1. Prompt the user for the initial value of the loan and store thevariable as “L_value”
  2. Prompt the user for the interest rate per month and store thevalue as “i_rate”
  3. Prompt the user for the number of months to calculate and storethe value as “n_mo”
  4. Prompt the user for the monthly payment and store as a variable“m_pay”
  5. Calculate the total current value of the loan for a month andstore is as “cl_val”
  6. Repeat the calculation for each month specified (n_mo) OR untilthe loan is paid off (cl_val is less than or equal to 0)
    1. You do NOT have to calculate the final payment amount to get toexactly 0
  7. Print the month number and the total loan amount for each monthcalculated

Answer & Explanation Solved by verified expert
4.3 Ratings (721 Votes)
SampleoutputsProgramscreenshotProgram code tocopy Taking input from userLvalue floatinputEnter the initial value of the loanirate    See Answer
Get Answers to Unlimited Questions

Join us to gain access to millions of questions and expert answers. Enjoy exclusive benefits tailored just for you!

Membership Benefits:
  • Unlimited Question Access with detailed Answers
  • Zin AI - 3 Million Words
  • 10 Dall-E 3 Images
  • 20 Plot Generations
  • Conversation with Dialogue Memory
  • No Ads, Ever!
  • Access to Our Best AI Platform: Flex AI - Your personal assistant for all your inquiries!
Become a Member

Other questions asked by students