Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a Python script that computes monthly interest payments for a home or car loan. Inputs: p = Loan amount (principal) r = Interest rate

  • Write a Python script that computes monthly interest payments for a home or car loan.
    Inputs: p = Loan amount (principal)
    r = Interest rate in percent
    n = Number of years (duration of loan)
    Output: m = Monthly payment
    Here is the formula:
    m =
    p r / 1200.0
    1 - (1.0 + r / 1200.0) 12 n
  • Use prompts for input to let the user know what to input; use text to explain what the output means.
  • Round the monthly payment is to the nearest cent.
  • Use Cel2Fahr and Distance as examples.
  • Optionally: validate p, r, and n with if statements to insure that they are all positive.
  • Pseudocode for Project 1, including input validation:
    Input principal using prompt "Enter amount of loan: ", assign to variable p. If p is less than 0, print error message, exit program. End Input interest rate using prompt "Interest rate in percent: ", assign to variable r. If r is less than 0, print error message, exit program. End Input term using prompt "Number of years: ", assign to variable n. If n is less than 0, print error message, exit program. End Compute monthly payment using formula, assign to variable m. Output monthly payment m.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Inference Control In Statistical Databases From Theory To Practice Lncs 2316

Authors: Josep Domingo-Ferrer

2002nd Edition

3540436146, 978-3540436140

More Books

Students also viewed these Databases questions

Question

4-6 Is there a digital divide? If so, why does it matter?

Answered: 1 week ago