The US uses a progressive approach to income taxes. Tax rates for 2011 (for singles) are
10% taxable income from 0 to $8,500
15% over $8,500 to $34,500
25% over $34,500 to $83,600
28% over $83,600 to $174,400
33% over $174,400 to $379,150
35% over $379,150
There are also a variety of deductions, credits, exclusions, etc., etc. (This isn’t a class in tax policy.) We
will ignore deductions in this example.
Tax credits are deducted off of the tax due after it is calculated. If, after all of the tax calculations are
done, you have tax credits, these are subtracted from the amount you pay. Tax credits are more desirable
than tax deductions, but they are both good things. For example, there are tax credits allowed for
1. Earned Income tax credit $457 for single taxpayer
2. Child and dependent care up to 35% of qualifying expenses
In this lab, you will get the opportunity to CREATE YOUR OWN TAX RULES and write a program that
calculates the taxes due based on user-entered income amount. Here are the guidelines:
1. At least 4 tax brackets (must be greater than 0%).
2. At least 2 tax credits. You must write the rule and explain how it will be implemented for each.

Do I need variables for each bracket and also each percent?

Recommended Answers

All 10 Replies

Everyone pays 10%. If income is greater than $8500, add 5%. If income is greater than $34,500 then add 10% more, etc. Deductions are a separate process and would be calculated before the tax is calculated as it reduces income. For more assistance, post your code so far.

Ok ill post when i get futher along.

# tax bracket 0 to 10,000 tax is 5%
# tax bracket 10,000 to 25,000 tax is 10%
# tax bracket 25,000 to 35,000 tax is 15%
# tax bracket over 35,000 tax is 25%

def main():
taxable_income=int(input('Enter your income here'))
tax=0
if taxable_income<=10000:
tax=.05*taxable_income
elif taxable_income<=25000:
tax =(0.05*10000)+(0.1*(taxable_income-10000))
elif taxable_income<=35000
tax =


print('Your tax due is $',format(tax,',.2f'))
main()

my made up taxes but i am not sure what to do on the last elif statement and else

You can also do it this way.

taxable_income=""
while not taxable_income.isdigit():
    print("Enter")
    taxable_income=input('Enter your income here (whole dollars only) ')
taxable_income = int(taxable_income)

tax=0
if taxable_income<=10000:
     tax=.05*taxable_income
elif taxable_income<=25000:
     tax = 0.1*taxable_income
elif taxable_income<=35000:
     tax = 0.15*taxable_income
else:
     tax = 0.25*taxable_income
print(tax)
#
#
tax_rates = ( (35000, 0.15), (25000, 0.10), (10000, 0.05) )
tax = 0.25*taxable_income  ## default = largest rate
for rate_tuple in tax_rates:
    if taxable_income <= rate_tuple[0]:
        tax = taxable_income*rate_tuple[1]
print(tax)

can you show me how to include two different tax credits in that system you did it

on my last line what would be writen after the tax = also how would the else statement look my way

#ROCKING MY TAXES THE WAY THEY SHOULD BE.
#CHARLES WILLIAMS
#JANET RENWICK
#10/19/2011
# tax bracket 0  to 10,000 tax is 5%
# tax bracket 10,000 to 25,000 tax is 10%
# tax bracket 25,000 to 35,000 tax is 15%
# tax bracket over 35,000 tax is 25%

def main():
    taxable_income=int(input('Enter your income here'))
    tax=0
    if taxable_income<=10000:
        tax=.05*taxable_income
    elif taxable_income<=25000:
        tax =(0.1*10000)+(0.1*(taxable_income-10000))
    elif taxable_income<=35000:
    	tax =(0.15*10000)+(0.1*(taxable_income-10000))
    else:
        tax =(0.25*10000)+ (0.1*(taxable_income-10000)
                            )
def credits():
    dog=int(input("enter number of dogs you have")
    if dog>=1:
        taxable_income=taxable_income-300
        print ("300 has been deducted away from your total)
    else:
        print("no deduction")
    cat=int(input("enter number of dogs")
    if cat >=1:
        taxable_income=taxable_income-200
        print("200 has been deducted away from your total)
    else:
        print("no dections have been taking away")      

        print('Your tax due is $',format(tax,',.2f'))
main()

why will it not run

geting a error after my : in my if statement about the dog

geting a error after my : in my if statement about the dog

That tells us nothing.

def calculate_tax():
    taxable_income=int(input('Enter your income here'))
    taxable_income=credits(taxable_income)
    tax=0
    if taxable_income<=10000:
        tax=.05*taxable_income
    elif taxable_income<=25000:
        tax =(0.1*10000)+(0.1*(taxable_income-10000))
    elif taxable_income<=35000:
    	tax =(0.15*10000)+(0.1*(taxable_income-10000))
    else:
        tax =(0.25*10000)+ (0.1*(taxable_income-10000)
                            )
def credits(taxable_income):
    dog=int(input("enter number of dogs you have")
    if dog>=1:
        taxable_income=taxable_income-300
        print ("300 has been deducted away from your total")
    else:
        print("no deduction")
    cat=int(input("enter number of dogs")
    if cat >=1:
        taxable_income=taxable_income-200
        print("200 has been deducted away from your total")
    else:
        print("no dections have been taking away")      
 
##        print('Your tax due is $',format(tax,',.2f'))

    return taxable_income

calculate_tax()
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.