In: Computer Science
Using Python
Write a program that does the following in order:
1. Asks the user to enter a name
2. Asks the user to enter a number “gross income”
3. Asks the user to enter a number “state tax rate”
4. Calculates the “Federal Tax”, “FICA tax” and “State tax”
5. Calculates the “estimated tax” and round the value to 2 decimal places
6. Prints values for “name”, “gross income” and “estimated tax”
The program should contain three additional variables to store the Federal tax, FICA tax, State tax, gross income, and estimated tax.
Federal Tax = gross income * 9.45%
FICA Tax = gross income * 7.65%
State Tax = gross income * your state tax percent
Estimated Tax = Federal tax + FICA tax + State tax
NOTE: Percentages must be converted to decimal values, for example:
15.9%=15.9*0.01=0.159
An example of the program’s input and output is shown below:
Enter your name: Belinda Patton
Enter your gross income: 53398.12
Enter your state income tax rate: 4.27
Belinda Patton’s estimated tax is $11411.08 based on a gross income of $53398.12
I WROTE THE CODE ALONG WITH THE COMMENTS
CODE:
#scan input.
name=input("Enter your name: ")
gross_income=float(input("Enter your gross income: "))
tax_rate=float(input("Enter your state income tax rate: "))
federal_tax=gross_income*(9.45*0.01) #calculate
federal_tax
fica_tax=gross_income*(7.65*0.01) #calculate fica_tax
state_tax=gross_income*(tax_rate*0.01) #calculate state_tax
estimated_tax=federal_tax+fica_tax+state_tax //calculate estimated_tax
#print results
print(name+"'s estimated tax is ${:.2f}".format(estimated_tax),"
based on a gross income of ${:.2f}".format(gross_income))
OUTPUT:
SCREENSHOT OF THE CODE: