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

Write a python program that lets the user enter the loan amount and loan period

ID: 3557382 • Letter: W

Question

Write a python program that lets the user enter the loan amount and loan period in number of years. The program will then display the monthly and total payments for each interest rate starting from 4 to 8 in increments of 1.

Be sure to define a function to calculate the values and print the table displaying the interest rate in the first column, the monthly payment in the second column, and the total payment in the third column. Your program should not allow the user to enter negative amounts for the loan amount and the loan period.

Once the table has been displayed the user should be prompted as to whether they wish to enter another loan amount and loan period. Save this program as Lab4Problem1.py

Necessary formulas:

Using the pow function from the math module:

monthlyPayment = loanAmt * monthlyRate / (1 - math.pow(1 / (1 + monthlyRate), numYears * 12))

totalPayment = monthlyPayment * numYears * 12

Explanation / Answer

def payment(x):

p=input("Enter The amount of the loan : ")

apr=input(" Enter The annual percentage interest rate: ")

years=input(" Enter The number of years of the loan: ")

max=input(" Enter The maximum monthly payment that the user can afford: ")

n=(int(years))*12

apr=(int(apr))/100.00

i=apr/12

m=((int(p))*i*((1+i)**n))/(((1+i)**n)-1)

tot=m*n

s="Loan Calculation Number"

print (s,x)

print (p,apr,years,n,i,m)

u="Your monthly payments will be "

v=" dollars"

print (u,m,v)

w="The total amount you will pay is "

print (w,tot,v)

y=" is "

x="The total amount of interest you will pay on a loan of "

print (x,p,v,y,tot)

if m<=(int(max)):

a="Yes, you can afford this loan."

print (a)

else:

b="No, you can not afford this loan."

print (b)

def main():

t=input("How many different loans do you want to calculate : ")

j=int(t)

k=1

while k<=j:

payment(x=k)

k=k+1

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