Added 2024 1001 Lecture code
parent
272bd4fc51
commit
82daf9b933
|
@ -0,0 +1,29 @@
|
|||
# Program to calculate the payments on an auto loan
|
||||
|
||||
message='''
|
||||
A = Monthly Payment
|
||||
P = Principal
|
||||
r = int rate per month
|
||||
n = number of months
|
||||
|
||||
|
||||
Problem
|
||||
=========
|
||||
P = 15090
|
||||
Term = 4 years = 48 months
|
||||
Int rate = 7%/year
|
||||
|
||||
Expect 361.07
|
||||
'''
|
||||
|
||||
P = input("Enter the principal for the loan ")
|
||||
P = float(P)
|
||||
|
||||
|
||||
n = 48
|
||||
r = .07/12
|
||||
|
||||
A = P * (r*(1+r)**n)/((1+r)**n - 1)
|
||||
|
||||
print("Monthly Payment = ",A)
|
||||
|
Binary file not shown.
|
@ -0,0 +1,39 @@
|
|||
# Program to calculate the payments on an auto loan
|
||||
|
||||
message='''
|
||||
A = Monthly Payment
|
||||
P = Principal
|
||||
r = int rate per month
|
||||
n = number of months
|
||||
|
||||
|
||||
Problem
|
||||
=========
|
||||
P = 15090
|
||||
Term = 4 years = 48 months
|
||||
Int rate = 7%/year
|
||||
|
||||
Expect 361.07
|
||||
'''
|
||||
|
||||
P = input("Enter the principal for the loan ")
|
||||
P = float(P)
|
||||
|
||||
loanTermYears = input("Enter the number of years for the loan ")
|
||||
loanTermYears = float(loanTermYears)
|
||||
|
||||
interestRatePerYear = input("Enter the annual interest rate for the loan ")
|
||||
interestRatePerYear = float(interestRatePerYear)/100
|
||||
|
||||
print(P,loanTermYears,interestRatePerYear)
|
||||
|
||||
n = loanTermYears * 12
|
||||
|
||||
r = interestRatePerYear / 12
|
||||
|
||||
print(n,r)
|
||||
|
||||
A = P * (r*(1+r)**n)/((1+r)**n - 1)
|
||||
|
||||
print("Monthly Payment = ",A)
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
# Program to calculate the payments on an auto loan
|
||||
|
||||
message='''
|
||||
A = Monthly Payment
|
||||
P = Principal
|
||||
r = int rate per month
|
||||
n = number of months
|
||||
|
||||
|
||||
Problem
|
||||
=========
|
||||
P = 15090
|
||||
Term = 4 years = 48 months
|
||||
Int rate = 7%/year
|
||||
|
||||
Expect 361.07
|
||||
'''
|
||||
|
||||
principal = input("Enter the principal for the loan ")
|
||||
principal = float(principal)
|
||||
|
||||
loanTermYears = input("Enter the number of years for the loan ")
|
||||
loanTermYears = float(loanTermYears)
|
||||
|
||||
interestRatePerYear = input("Enter the annual interest rate for the loan ")
|
||||
interestRatePerYear = float(interestRatePerYear)/100
|
||||
|
||||
#print(principal,loanTermYears,interestRatePerYear)
|
||||
|
||||
loanTermMonthly = loanTermYears * 12
|
||||
|
||||
interestRateMonthly = interestRatePerYear / 12
|
||||
|
||||
#print(loanTermMonthly,interestRateMonthly)
|
||||
|
||||
monthlyPayment = principal * (interestRateMonthly*(1+interestRateMonthly)**loanTermMonthly)/((1+interestRateMonthly)**loanTermMonthly - 1)
|
||||
|
||||
print("Monthly Payment = ",monthlyPayment)
|
||||
|
|
@ -0,0 +1,18 @@
|
|||
https://www.wikihow.com/Calculate-Auto-Loan-Payments
|
||||
|
||||
A = P * (r(1+r)**n)/(1+r)**n - 1)
|
||||
|
||||
A = Monthly Payment
|
||||
P = Principal
|
||||
r = int rate per month
|
||||
n = number of months
|
||||
|
||||
|
||||
Problem
|
||||
=========
|
||||
P = 15090
|
||||
Term = 4 years = 48 months
|
||||
Int rate = 7%/year
|
||||
|
||||
Expect 361.07
|
||||
|
Loading…
Reference in New Issue