Question

In: Computer Science

PLEASE DO THIS WITH PYTHON 3 Lab 4-2: Computing Tax The United States federal personal income...

PLEASE DO THIS WITH PYTHON 3

Lab 4-2: Computing Tax

The United States federal personal income tax is calculated based on filing status and taxable income. There are four filing statuses: single filers, married filing jointly, married filing separately, and head of household. The tax rates vary every year. Table 3.2 shows the rates for 2009. If you are, say, single with a taxable income of $10,000, the first $8,350 is taxed at 10% and the other $1,650 is taxed at 15%. So, your tax is $1,082.5.

Table 1

2009 U.S. Federal Personal Tax Rates

Marginal Tax Rate

Single

Married Filing Jointly or Qualified Widow(er)

Married Filing Separately

Head of Household

10%

$0 – $8,350

$0 – $16,700

$0 – $8,350

$0 – $11,950

15%

$8,351– $33,950

$16,701 – $67,900

$8,351 – $33,950

$11,951 – $45,500

25%

$33,951 – $82,250

$67,901 – $137,050

$33,951 – $68,525

$45,501 – $117,450

28%

$82,251 – $171,550

$137,051 – $208,850

$68,525 – $104,425

$117,451 – $190,200

33%

$171,551 – $372,950

$208,851 – $372,950

$104,426 – $186,475

$190,201 - $372,950

35%

$372,951+

$372,951+

$186,476+

$372,951+

You are to write a program to compute personal income tax. Your program should prompt the user to enter the filing status and taxable income and compute the tax. Enter 0 for single filers, 1 for married filing jointly, 2 for married filing separately, and 3 for head of household.

Here are sample runs of the program:

Sample 1:

Enter the filing status: 0

Enter the taxable income: 100000

Tax is 21720.0

Sample 2:

Enter the filing status: 1

Enter the taxable income: 300339

Tax is 76932.87

Sample 3:

Enter the filing status: 2

Enter the taxable income: 123500

Tax is 29665.5

Sample 4:

Enter the filing status: 3

Enter the taxable income: 4545402

Tax is 1565250.7

Solutions

Expert Solution

"""

Author:
Date :20/3/17
File Name:compute_tax.py
Description:

"""


def calculate_tax_single(income):
    """
    This function compute tax for single filler
    :param income: 
    :return: 
    """
    tax = 835.0
    if 8350 < income <= 33950:
        tax += (income - 8350) * 15 / 100
    elif income > 33950:
        tax += (33950 - 8350) * 15 / 100

    if 33950 < income <= 82250:
        tax += (income - 33950) * 25 / 100
    elif income > 82250:
        tax += (82250 - 33950) * 25 / 100

    if 82250 < income <= 171550:
        tax += (income - 82250) * 28 / 100
    elif income > 171550:
        tax += (171550 - 82250) * 28 / 100

    if 171550 < income <= 372950:
        tax += (income - 171550) * 33 / 100
    elif income > 372950:
        tax += (372950 - 171550) * 33 / 100

    if income >= 372951:
        tax += (income - 372950) * 35 / 100

    return "{:.2f}".format(tax, 1)


def calculate_tax_married_joint(income):
    """
    This function compute tax for married joint filler 
    :param income: 
    :return: 
    """
    tax = 16700 * 10 / 100
    if 16700 < income <= 67900:
        tax += (income - 16700) * 15 / 100
    elif income > 67900:
        tax += (67900 - 16700) * 15 / 100

    if 67900 < income <= 137050:
        tax += (income - 67900) * 25 / 100
    elif income > 137050:
        tax += (137050 - 67900) * 25 / 100

    if 137050 < income <= 208850:
        tax += (income - 137050) * 28 / 100
    elif income > 208850:
        tax += (208850 - 137050) * 28 / 100

    if 208850 < income <= 372950:
        tax += (income - 208850) * 33 / 100
    elif income > 372950:
        tax += (372950 - 208850) * 33 / 100

    if income >= 372951:
        tax += (income - 372950) * 35 / 100

    return "{:.2f}".format(tax, 1)


def calculate_tax_married_separate(income):
    """
    This function compute tax for married separate filler 
    :param income: 
    :return: 
    """
    tax = 835.0
    if 8350 < income <= 33950:
        tax += (income - 8350) * 15 / 100
    elif income > 33950:
        tax += (33950 - 8350) * 15 / 100

    if 33950 < income <= 68525:
        tax += (income - 33950) * 25 / 100
    elif income > 68525:
        tax += (68525 - 33950) * 25 / 100

    if 68525 < income <= 104425:
        tax += (income - 68525) * 28 / 100
    elif income > 104425:
        tax += (104425 - 68525) * 28 / 100

    if 104425 < income <= 186475:
        tax += (income - 104425) * 33 / 100
    elif income > 186475:
        tax += (186475 - 104425) * 33 / 100

    if income >= 186476:
        tax += (income - 186475) * 35 / 100

    return "{:.2f}".format(tax, 1)


def calculate_tax_household(income):
    """
    This function compute tax for household filler 
    :param income: 
    :return: 
    """
    tax = 11950.0 * 10 / 100
    if 11950 < income <= 45500:
        tax += (income - 11950) * 15 / 100
    elif income > 45500:
        tax += (45500 - 11950) * 15 / 100

    if 45500 < income <= 117450:
        tax += (income - 45500) * 25 / 100
    elif income > 117450:
        tax += (117450 - 45500) * 25 / 100

    if 117450 < income <= 190200:
        tax += (income - 117450) * 28 / 100
    elif income > 190200:
        tax += (190200 - 117450) * 28 / 100

    if 190200 < income <= 372950:
        tax += (income - 190200) * 33 / 100
    elif income > 372950:
        tax += (372950 - 190200) * 33 / 100

    if income >= 186476:
        tax += (income - 372950) * 35 / 100

    return "{:.2f}".format(tax, 1)


if __name__ == '__main__':

    while True:
        filing_status = int(input("enter the filing status : ").strip())
        taxable_income = float(input("Enter the taxable income :").strip())
        if filing_status == 0:
            print("Tax is", calculate_tax_single(taxable_income))
        elif filing_status == 1:
            print("Tax is", calculate_tax_married_joint(taxable_income))
        elif filing_status == 2:
            print("Tax is", calculate_tax_married_separate(taxable_income))
        elif filing_status == 3:
            print("Tax is", calculate_tax_household(taxable_income))
        opt = input("Do you want to continue?Y/N:").strip()
        if opt.lower() == "n":
            break

output:


Related Solutions

The United States federal personal income tax is calculated based on filing status and taxable income....
The United States federal personal income tax is calculated based on filing status and taxable income. There are four filing statuses (in this program we’ll use only three): single filers, married filing jointly, and head of household. The tax rates vary every year. Table 1 shows the rates for 2016. If you are, say, single with a taxable income of $10,000, the first $9,075 is taxed at 10% and the other $925 is taxed at 15%. So, your tax is...
Research and write the history of the United States Federal Income Tax Law.
Research and write the history of the United States Federal Income Tax Law.
Is the current progressive federal income tax used in the United States equitable?
Is the current progressive federal income tax used in the United States equitable?
Problem 1 The United States Federal Income tax for taxes due July 15, 2020 is available...
Problem 1 The United States Federal Income tax for taxes due July 15, 2020 is available at this link: https://www.bankrate.com/finance/taxes/tax-brackets.aspx The four tax filing categories are: 0 - single filer, 2 - head of household, 3 - married filing jointly or qualifying widow, and 4 - married filing seperately. Write a Java program that prompts the user to enter the name, filing status, and annual income. The program returns the federal income tax due. (10 Points) A sample run should...
Give five examples of adjustments that states make to a taxpayer's federal tax base in computing...
Give five examples of adjustments that states make to a taxpayer's federal tax base in computing a state's taxable income. To comply with the Commerce Clause of the US Constitution, a state tax must satisfy which requirements? List five in-state activities that the Multistate Tax Commission does not consider either solicitation of orders or ancillary activities
the impact of changing our current federal tax code to a proportional tax for personal income...
the impact of changing our current federal tax code to a proportional tax for personal income from the current progressive tax we have currently. What you feel would be the impact on tax revenue, labor supply, etc. Explain in detail.
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and...
Please answer using python 3 and def functions! Lab 2 Drill 3: (function practice) create and use a function named highest() that takes three inputs and returns the highest number. After you have got it working, try calling the function with inputs ‘hat’, ‘cat’, ‘rat’.
Personal Federal income tax rate is 30%. You are trying to decide which of the following...
Personal Federal income tax rate is 30%. You are trying to decide which of the following bonds to invest in. Both are BBB rate. 1.) Kentucky Bond has a 3.2% yield. 2.) Boeing has a 4.5% yield. Which bond would you invest in and why? Show work ... this is all the given information
1. which of the following describes the original design intent of the federal personal income tax...
1. which of the following describes the original design intent of the federal personal income tax a) regressive tax b) proportional tax c) poll tax d) progressive tax e) payroll tax 2. bobby pays a tax of $5000 on her income of $50,000 while brad pays a tax of $700 on his income of $18,000 a) regressive b) a flat tax c) proportional d) progressive 3.an example of progressive tax is a) the excise tax of cugarettes b) the federal...
Tax Return-Individual Number One (after Chapter 4) Instructions: Please complete the 2018 federal income tax return...
Tax Return-Individual Number One (after Chapter 4) Instructions: Please complete the 2018 federal income tax return for Jonathan Hales. Be sure to include only required tax forms when completing the tax return. Ignore the requirement to attach the form(s) W-2 to the front page of the Form 1040. If required information is missing, use reasonable assumptions to fill in the gaps. Jonathan Hales attended State University as a part-time student during the year. Jonathan lived at home with his parents...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT