Added code for lecture 2026-11-10

This commit is contained in:
Edward Bigos 2026-11-10 12:28:09 -05:00
commit 07b9e54bf0
52 changed files with 1248 additions and 1 deletions

View file

@ -0,0 +1,50 @@
'''
Auto Loan Payment Calculations
==============================
https://www.wikihow.com/Calculate-Auto-Loan-Payments
Use the formula A = P ∗ ( r ( 1 + r ) n ) / ( ( 1 + r ) n − 1 )
A = the monthly payment.
P = the principal
r = the interest rate per month, which equals the annual interest rate divided by 12
n = the total number of months
Mass Sales Tax
==============
The .0625 (6.25%) sales tax is paid in the first year only.
https://www.mass.gov/guides/motor-vehicle-and-trailer-sales-and-use-tax
Mass Excise Tax Fees
====================
The tax depends on the vehicle age. For this program we only calculate the
excise tax on the first year of purchase.
https://www.sec.state.ma.us/divisions/cis/tax/motor-excise.htm
'''
# ======================= Input Variables ==================================
principal = 15090.
rate = .07
numberOfYears = 4
# ===========================================================================
rate = rate /100
ratePerMonth = rate /12
numberOfMonths = numberOfYears * 12
salesTax = principal * .0625 # Mass sales tax rate
# https://www.sec.state.ma.us/divisions/cis/tax/motor-excise.htm
exciseTax = principal / 1000 * .9 * 25.00
monthlyPayment = principal * (ratePerMonth * (1+ratePerMonth)**(numberOfMonths))/((1+ratePerMonth)**(numberOfMonths)-1)
print("The payment is ", monthlyPayment)
print(f"The payment is ${monthlyPayment:.2f}")
print("The sales tax is ", salesTax)
print("The excise tax is ", exciseTax)
print("First years expense is ", monthlyPayment*12 + salesTax + exciseTax)