Question

In: Computer Science

(PYTHON) Write a program: This assignment will give you more experience on the use of: 1....

(PYTHON) Write a program:

This assignment will give you more experience on the use of:

1. integers (int)

2. floats (float)

3. conditionals

4. iteration

The goal of this project is to make a fictitious comparison of the federal income. You will ask the user to input their taxable income. Use the income brackets given below to calculate the new and old income tax. For the sake of simplicity of the project we will only consider individuals and not married users. We will also ignore any tax deductions while calculating income tax they can significantly alter the tax, but add too much complexity for our programming project.

New income tax brackets (2018 and newer)

Rate     Income range

10%      Up to $9,525

12%      $9,526 to $38,700

22%      $38,701 to $82,500

24%      $82,501 to $157,500

32%      $157,501 to $200,000

35%      $200,001 to $500,000

37%      over $500,000

Old income tax brackets (2017 and older)

Rate     Income     range    

10%      Up to $9,325

15%      $9,326 to $37,950

25%      $37,951 to $91,900

28%      $91,901 to $191,650

33%      $191,651 to $416,700

35%      $416,701 to $418,400

39.6%   over $418,401

Assignment Background

Being in the 25% tax bracket doesn’t mean you pay 25% on everything you make. The progressive tax system means that people with higher taxable incomes are subject to higher tax rates, and people with lower taxable incomes are subject to lower tax rates.

For example, let’s say you’re a filer with $32,000 in taxable income. That puts you in the 15% tax bracket in 2017. But do you pay 15% on all $32,000? No. Actually, you pay only 10% on the first $9,325; you pay 15% on the rest. (Look at the tax brackets above to see the breakout.) If you had $50,000 of taxable income, you’d pay 10% on that first $9,325 and 15% on the chunk of income between $9,326 and $37,950. And then you’d pay 25% on the rest, because some of your $50,000 of taxable income falls into the 25% tax bracket. The total bill would be $8,238.75 — about 16% of your taxable income, even though you’re in the 25% bracket.

Project Description

Your program must meet the following specifications:

1. At program start, prompt the user for their income

2. Repeatedly prompt the user for new income until a negative income is entered.

3. Calculate the income tax using the 2017 and 2018 tax bracket tables above.

4. For each income entered:

a. Calculate the 2017 income tax and store it in a variable.

b. Next calculate the 2018 income tax and store it in a variable

c. Print

i. The income

ii. The 2017 tax

iii. The 2018 tax

iv. The difference between the 2018 and 2017 tax rounded to cents.

v. The difference between the 2018 and 2017 tax as a percentage of the 2017 tax rounded to cents

Assignment Notes

1.   To clarify the project specifications, sample output is appended to the end of this document.

2.   Use a while loop with a Boolean that keeps looping as long as the income is greater than or equal to zero. Prompt for income before the loop and remember to convert the input string to an int (so you are comparing an int in your Boolean expression). Remember to prompt again at the end (aka “bottom”) of the loop.

4.   There will be no error checking in this assignment. If a float or a string is entered at the prompt, the program will crash.

Solutions

Expert Solution

#################### PGM START #####################################

if __name__=="__main__":
  
  
    taxNew=0
    taxOld=0
  
    income=float(input("Enter the income: "))
  

    while(income>=0):
         #claculating 2018 tax
         if(income<=9525):
             taxNew=income*0.10
         elif(income>=9526 and income<=38700):
             taxNew=952.6+((income-9526)*0.12)
         elif(income>=38701 and income<=82500):
             taxNew=4453.48+((income-38701)*0.22)
         elif(income>=82501 and income<=157500):
             taxNew=14089.26+((income-82501)*0.24)
         elif(income>=157501 and income<=200000):
             taxNew=32089.02+((income-157501)*0.32)
         elif(income>=200001 and income<=500000):
             taxNew=45688.7+((income-200001)*0.35)
         elif(income>500000):
             taxNew=150688.35+((income-500000)*0.37)
           
       
         #calculating 2017 tax
         tO1=9325*0.10
         tO2=(37950-9326)*0.15
         tO3=(91900-37951)*0.25
         tO4=(191650-91901)*0.28
         tO5=(416700-191651)*0.33
         tO6=(418400-416701)*0.35
       
         if(income<=9325):
             taxOld=income*0.10
         elif(income>=9326 and income<=37950):
             taxOld=tO1+((income-9326)*0.15)
         elif(income>=37951 and income<=91900):
             taxOld=tO1+tO2+((income-37951)*0.25)
         elif(income>=91901 and income<=191650):
             taxOld=tO1+tO2+tO3+((income-91901)*0.28)
         elif(income>=191651 and income<=416700):
             taxOld=tO1+tO2+tO3+tO4+((income-191651)*0.33)
         elif(income>=416701 and income<=418400):
             taxOld=tO1+tO2+tO3+tO4+tO5+((income-416701)*0.35)
         elif(income>=418401):
             taxOld=tO1+tO2+tO3+tO4+tO5+tO6+((income-418401)*0.396)


         print("Income: $"+str(income))
         print("2017 Tax: $"+str(taxOld))
         print("2018 Tax: $"+str(taxNew))
         print("2018-2017 Tax Difference(Cents): "+str(round((taxNew-taxOld)*100)))
         print("2018-2017 Tax %: "+str(round(((taxNew-taxOld)/taxOld)*100)))
       
         income=float(input("\n\nEnter the income: "))

################# PGM END ##########################################
OUTPUT
########


Related Solutions

This assignment will give you more experience on the use of: 1. integers (int) 2. floats...
This assignment will give you more experience on the use of: 1. integers (int) 2. floats (float) 3. conditionals 4. iteration The goal of this project is to make a fictitious comparison of the federal income. You will ask the user to input their taxable income. Use the income brackets given below to calculate the new and old income tax. For the sake of simplicity of the project we will only consider individuals and not married users. We will also...
This assignment will give you more experience on the use of: 1. integers (int) 2. floats...
This assignment will give you more experience on the use of: 1. integers (int) 2. floats (float) 3. conditionals(if statements) 4. iteration(loops) Functions, lists, dictionary, classes CANNOT BE USED!!! The goal of this project is to make a fictitious comparison of the federal income. You will ask the user to input their taxable income. Use the income brackets given below to calculate the new and old income tax. For the sake of simplicity of the project we will only consider...
[Python programming] Functions, lists, dictionary, classes CANNOT BE USED!!! This assignment will give you more experience...
[Python programming] Functions, lists, dictionary, classes CANNOT BE USED!!! This assignment will give you more experience on the use of: 1. integers (int) 2. floats (float) 3. conditionals(if statements) 4. iteration(loops) The goal of this project is to make a fictitious comparison of the federal income. You will ask the user to input their taxable income. Use the income brackets given below to calculate the new and old income tax. For the sake of simplicity of the project we will...
For Python: In this assignment you are asked to write a Python program to determine the...
For Python: In this assignment you are asked to write a Python program to determine the Academic Standing of a studentbased on their CGPA. The program should do the following: Prompt the user to enter his name. Prompt the user to enter his major. Prompt the user to enter grades for 3 subjects (A, B, C, D, F). Calculate the CGPA of the student. To calculate CGPA use the formula: CGPA = (quality points * credit hours) / credit hours...
1. INTRODUCTION The goal of this programming assignment is for students to write a Python program...
1. INTRODUCTION The goal of this programming assignment is for students to write a Python program that uses repetition (i.e. “loops”) and decision structures to solve a problem. 2. PROBLEM DEFINITION  Write a Python program that performs simple math operations. It will present the user with a menu and prompt the user for an option to be selected, such as: (1) addition (2) subtraction (3) multiplication (4) division (5) quit Please select an option (1 – 5) from the...
In this assignment you will write a program that encrypts a text file.  You will use the...
In this assignment you will write a program that encrypts a text file.  You will use the following encryption scheme. Ask the user for the name of the original file. Ask the user for the name of the output file. Ask the user for the encryption key, n. Read n2 characters from the file into the n rows and n columns of a 2-dimensional array. Transpose the array.  (Exchange the rows and columns.) Write the characters from the array to an output...
In this assignment, you are going to write a Python program to demonstrate the IPO (Input-Process-Output)...
In this assignment, you are going to write a Python program to demonstrate the IPO (Input-Process-Output) cycle that is the heart of many imperative programs used for processing large amount of data. Daisy is recently hired by a warehouse. One of her job is to keep track the items ordered by all the branches of the company. The company wants to automate the task using a computer program. Being a friend of Daisy, she knows you are a Computer Science...
Python Problem Problem 1: In this problem you are asked to write a Python program to...
Python Problem Problem 1: In this problem you are asked to write a Python program to find the greatest and smallest elements in the list. The user gives the size of the list and its elements (positive and negative integers) as the input. Sample Output: Enter size of the list: 7 Enter element: 2 Enter element: 3 Enter element: 4 Enter element: 6 Enter element: 8 Enter element: 10 Enter element: 12 Greatest element in the list is: 12 Smallest...
use python 1. Write a program that a. defines a list of countries that are members...
use python 1. Write a program that a. defines a list of countries that are members of BRICS (Brazil, Russia, India, China, Sri Lanka) b. Check whether a country is a member of BRICS or not Program run Enter the name of country: Pakistan Pakistan is not a member of BRICS Enter the name of country : India India is a member of BRICS 2. Write a program to create a list of numbers in the range of 1 to...
Using Python, Assignment Write a program that plays a game of craps. The program should allow...
Using Python, Assignment Write a program that plays a game of craps. The program should allow the player to make a wager before each “turn”. Before each turn, allow the user to either place a bet or exit the game. After each turn display the player’s current balance. Specifics Each player will start with $500.00. Initially, and after each turn give the user the option of betting or leaving the program. Implement this any way you wish, but make it...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT