Added 2024 1001 Lecture code

main
Edward Bigos 2024-10-02 11:03:01 -04:00
parent 272bd4fc51
commit 82daf9b933
5 changed files with 125 additions and 0 deletions

View File

@ -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)

View File

@ -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)

View File

@ -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)

View File

@ -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