Answered step by step
Verified Expert Solution
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 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started