Question

In: Computer Science

Write a program that asks the user for their filing status (single or married) and their...

Write a program that asks the user for their filing status (single or married) and their taxable income. Then, using the below table, compute the tax owed and display the filing status, taxable income, and tax owed.

If the filing status is single and the taxable income is overbut not over   the tax is of the amount over$0$9,52510%0$9,526$38,700$952.50 + 12%$9,525$38,701$82,500$4,453.50 +22%
$38,700
$82,501unlimited$14,089.50 +24%
$82,500
If the filing status is married filing jointly and the taxable income is overbut not overthe tax is of the amount over$0$19,05010%$0$19,051$77,400$1,905 + 12%$19,050$77,401$165,000$8,907 + 22%$77,400$165,001unlimited$28,179 + 24%$165,000

Here are some check figures:


Single filer with $50,000 taxable income owes $6,939.50 tax


Married filer with $25,000 taxable income owes $2,619.00 tax


Married filer with $200,000 taxable income owes $36,579.00 tax


Be sure to follow the Program Submission Guidelines document from last week. Save the program and upload the .py file here.

Solutions

Expert Solution

Program


income=None
sum=0
print("Personal Income Tax Calculator\n")
print("Valid Filing Statuses(0=Unmarried Filer, 1=Married Filing Jointly, 2=Head of Household")
status=(int(input("Enter the filing status: ")))
while (status>3):
    print("Enter valid filing status!!!")
    status=(int(input("Enter the filing status: ")))   

income=(float(input("Enter your taxable income: ")))
while income<0:
    print("Enter valid income!!!")
    income=(float(input("Enter your taxable income: ")))

# Compute tax
tax = 0

if status == 0: # Compute tax for single filers
    if income <= 9525:
        tax = income * 0.10
    elif income <= 38700:
        tax = 9525 * 0.10 + (income - 9525) * 0.12
    elif income <= 82500:
        tax = 9525 * 0.10 + (38700 - 9525) * 0.12 +(income - 38700) * 0.22
    elif income <= 157500:
        tax = 9525 * 0.10 + (38700 - 9525) * 0.12 + (82500 - 38700) * 0.22 + (income - 82500) * 0.24
    elif income <= 200000:
        tax = 9525 * 0.10 + (38700 - 9525) * 0.12 + \
            (82500 - 38700) * 0.22 + (157500 - 82500) * 0.24 + \
            (income - 200000) * 0.35
    elif income <= 500000:
        tax = 9525* 0.10 + (38700 - 9525) * 0.12 + \
              (82500 - 38700) * 0.22 + (157500 - 82500) * 0.24 + \
              (200000 - 157500) * 0.32 + (income - 500000) * 0.35
    else:
        tax = 9525* 0.10 + (38700 - 9525) * 0.12 + \
              (82500 - 38700) * 0.22 + (157500 - 82500) * 0.24 + \
              (200000 - 157500) * 0.32 + (500000 - 200000) * 0.35++ (income - 500000) * 0.37;

       
elif status == 1: # Compute tax for married file jointly
    if income <= 19050:
        tax = income * 0.10
    elif income <= 77400:
        tax = 19050 * 0.10 + (income - 19050) * 0.12
    elif income <= 165000:
        tax = 19050 * 0.10 + (77400 - 19050) * 0.12 +(income - 77400) * 0.22
    elif income <= 315000:
        tax = 19050 * 0.10 + (77400 - 19050) * 0.12 + (165000 - 77400) * 0.22 + (income - 165000) * 0.24
    elif income <= 400000:
        tax = 19050 * 0.10 + (77400 - 19050) * 0.12 + \
            (165000 - 77400) * 0.22 + (315000 - 165000) * 0.24 + \
            (income - 315000) * 0.35
    elif income <= 600000:
        tax = 19050 * 0.10 + (77400 - 19050) * 0.12 + \
            (165000 - 77400) * 0.22 + (315000 - 165000) * 0.24 + \
              (400000 - 315000) * 0.32 + (income - 400000) * 0.35
    else:
        tax = 19050 * 0.10 + (77400 - 19050) * 0.12 + \
            (165000 - 77400) * 0.22 + (315000 - 165000) * 0.24 + \
              (400000 - 315000) * 0.32 + (600000 - 400000) * 0.35++ (income - 600000) * 0.37;

       

   
elif status == 2: # Compute tax for head of households
    if income <= 13600:
        tax = income * 0.10
    elif income <= 51800:
        tax = 13600 * 0.10 + (income - 13600) * 0.12
    elif income <= 82500:
        tax = 13600 * 0.10 + (51800 - 13600) * 0.12 +(income - 51800) * 0.22
    elif income <= 157500:
        tax = 13600 * 0.10 + (51800 - 13600) * 0.12 + (82500 - 51800) * 0.22 + (income - 82500) * 0.24
    elif income <= 200000:
        tax = 13600 * 0.10 + (51800 - 13600) * 0.12 + (82500 - 51800) * 0.22 + (157500 - 82500) * 0.24 + \
            (income - 200000) * 0.35
    elif income <= 500000:
        tax = 13600 * 0.10 + (51800 - 13600) * 0.12 + (82500 - 51800) * 0.22 + (157500 - 82500) * 0.24 + \
              (200000 - 157500) * 0.32 + (income - 500000) * 0.35
    else:
        tax = 13600 * 0.10 + (51800 - 13600) * 0.12 + (82500 - 51800) * 0.22 + (157500 - 82500) * 0.24 + \
              (200000 - 157500) * 0.32 + (500000 - 200000) * 0.35++ (income - 500000) * 0.37;

else:
    print("Error: invalid status")
    sys.exit()

# Display the result

print("Your income tax for 2018 will be : $ {:0.2f}".format(tax))

Output


Related Solutions

C++. Write a program that asks the user to enter a single word and outputs the...
C++. Write a program that asks the user to enter a single word and outputs the series of ICAO words that would be used to spell it out. The corresponding International Civil Aviation Organization alphabet or ICAO words are the words that pilots use when they need to spell something out over a noisy radio channel. See sample screen output for an example: Enter a word: program Phonetic version is: Papa Romeo Oscar Golf Romeo Alpha Mike The specific requirement...
Write a C++ program that asks the user to enter a series of single-digit numbers with...
Write a C++ program that asks the user to enter a series of single-digit numbers with nothing separating them. Read the input as a C-string or a string object. The program should display the sum of all the single-digit numbers in the string. For example, if the user enters 2514, the program should display 12, which is the sum of 2, 5, 1, and 4. The program should also display the highest and lowest digits in the string. It is...
Write a java simple document retrieval program that first asks the user to enter a single...
Write a java simple document retrieval program that first asks the user to enter a single term query, then goes through two docuements named doc1.txt and doc2.txt (provided with assignment7) to find which document is more relevant by calculating the frequency of the query term in each document. Output the conclusion to a file named asmnt7output.txt in the following format (as an example for query “java” and “problem”). The percentages in parenthese are respective supporting frequencies. java: doc1(6.37%) is more...
Write a program that asks the user for an integer. The program checks and prints to...
Write a program that asks the user for an integer. The program checks and prints to the screen whether the number is prime or not. For example, if user enters 17, the program should print “17 is prime”; if the user enters 20, the program should print “20 is not prime”. please do it with a “ while Loop”, Thanks..
Python: Write a program that asks the user for the name of a file. The program...
Python: Write a program that asks the user for the name of a file. The program should display the contents of the file line by line.
Write a program that asks the user to enter the name of a file, and then...
Write a program that asks the user to enter the name of a file, and then asks the user to enter a character. The program should count and display the number of times that the specified character appears in the file. Use Notepad or another text editor to create a sample file that can be used to test the program. Sample Run java FileLetterCounter Enter file name: wc4↵ Enter character to count: 0↵ The character '0' appears in the file...
Write a program that asks the user for the lengths of the sides of a rectangle....
Write a program that asks the user for the lengths of the sides of a rectangle. Again, check for valid input and exit with an error msg if you don’t get it. Testing: use some known values to confirm that the calculations are correct. E.g. 3 – 4 - 5 triangle >> 3 X 4 rectangle Then print • The area and perimeter of the rectangle • The length of the diagonal (use the Pythagorean theorem). This question should be...
This is Java In this problem we will write a program that asks the user to...
This is Java In this problem we will write a program that asks the user to enter a) The user's first name and b) a series of integers separated by commas. The integers may not include decimal points nor commas. The full string of numbers and commas will not include spaces either, just digits and commas. An example of valid input string is:        7,9,10,2,18,6 The string must be input by the user all at once; do not use a loop...
Write a program that asks the user for an angle, entered in radians. The program should...
Write a program that asks the user for an angle, entered in radians. The program should then display the sine, cosine, and tangent of the angle. (Use the sin, cos, and tan library functions to determine these values.) The output should be displayed in fixed-point notation, rounded to four decimal places of precision Take your previous Angle Calculator program and modify it to do a table of trig values. The columns will be: Degrees, Sine, Cosine, Tangent,. And the rows...
Write a program IN JAVA that asks the user for a number. The program should check...
Write a program IN JAVA that asks the user for a number. The program should check the number to ensure that it is valid (if not, the user should enter a valid number to continue.) The program should print out all of the prime numbers from 2 up to the number, with up to 10 numbers per line. (Recall: A prime number is a number that is only divisible by itself and 1.) The code should ask the user if...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT