Question

In: Computer Science

Create a Python program that will calculate the user’s net pay based on the tax bracket...

Create a Python program that will calculate the user’s net pay based on the tax bracket he/she is in. Your program will prompt the user for their first name, last name, their monthly gross pay, and the number of dependents.

The number of dependents will determine which tax bracket the user ends up in. The tax bracket is as followed:

  • 0 – 1 Dependents : Tax = 20%
  • 2 – 3 Dependents : Tax = 15%
  • 4+ Dependents :    Tax = 10%

After calculating the net pay, print the name of the user, the monthly gross pay, the number of dependents, the gross pay, the tax rate, and the net pay.

The formula to compute the net pay is: monthly gross pay – (monthly pay * tax rate)

Solutions

Expert Solution

SCREENSHOT:

CODE:

## input first name
f_name = input("Enter your first name: ")
## input last name
l_name = input("Enter your last name: ")
## input monthly gross pay
gross_pay = float(input("Enter your monthly gross pay: "))
## input the number of dependents
no_of_dep = int(input("Enter the number of dependents: "))
## initiaslizing tax_rate
tax_rate = 0

## determining tax_rate with no of dependents
if(no_of_dep <= 1):
tax_rate = 20
elif no_of_dep == 2 or no_of_dep == 3:
tax_rate = 15
elif no_of_dep >= 4:
tax_rate = 10

## calculating the tax on the monthly gross pay
tax = gross_pay * (tax_rate/100)
## calculating monthly net pay by deducting the tax from the gross pay
monthly_net_pay = gross_pay - tax
## calculating the net pay
net_pay = gross_pay - (monthly_net_pay * (tax_rate/100))

## Output
print("Name: " + f_name + " " + l_name)
print("Monthly gross pay: " + str(gross_pay))
print("Monthly pay: " + str(monthly_net_pay))
print("Tax Rate: " + str(tax_rate))
print("No. of dependents: " + str(no_of_dep))
print("Net pay: " + str(net_pay))

OUTPUT:


Related Solutions

In C Program #include Create a C program that calculates the gross and net pay given...
In C Program #include Create a C program that calculates the gross and net pay given a user-specified number of hours worked, at minimum wage. The program should compile without any errors or warnings (e.g., syntax errors) The program should not contain logical errors such as subtracting values when you meant to add (e.g., logical errors) The program should not crash when running (e.g., runtime errors) When you run the program, the output should look like this: Hours per Week:...
If Isabella Rodriguez is single and in the 35 percent tax bracket, calculate the tax associated...
If Isabella Rodriguez is single and in the 35 percent tax bracket, calculate the tax associated with each of the following transactions. (Hint: Use the IRS regulations for capital gains in effect in 2018.) Treat each of the following cases as independent of the others. Tax savings should be preceded by a "-" sign. Round the answers to the nearest cent. She sold stock for $3,930 that she purchased for $3,000 4 months earlier. $ _____ She sold bonds for...
Write a program in python to calculate the amount each person must pay toward the bill...
Write a program in python to calculate the amount each person must pay toward the bill and toward the tip, for a group of friends who are eating out together. Since you are all friends, it is okay to split the costs evenly. Your program should take as input: The restaurant bill (without tax or tip) as a floating point number The sales tax rate as a floating point number (for example: an 8% tax rate would be 0.08) The...
Create a Java application called ValidatePassword to validate a user’s password. Write a program that asks...
Create a Java application called ValidatePassword to validate a user’s password. Write a program that asks for a password, then asks again to confirm it. If the passwords don’t match or the rules are not fulfilled, prompt again. Your program should include a method that checks whether a password is valid. From that method, call a different method to validate the uppercase, lowercase, and digit requirements for a valid password. Your program should contain at least four methods in addition...
Create a menu-based program that will allow the user to calculate the area for a few...
Create a menu-based program that will allow the user to calculate the area for a few different shapes: square, rectangle, parallelogram, and circle. Refer to the Sample Output in this document to see what menu options you should use. Create PI as a global constant variable. Main Function use do-while to repeat program until user chooses option 5 call the displayMenu function get user choice & validate with while loop depending on user’s choice, get the data required to calculate...
Create a menu-based program that will allow the user to calculate the area for a few...
Create a menu-based program that will allow the user to calculate the area for a few different shapes: square, rectangle, parallelogram, and circle. Refer to the Sample Output in this document to see what menu options you should use. Create PI as a global constant variable. Main Function use do-while to repeat program until user chooses option 5 call the displayMenu function get user choice & validate with while loop depending on user’s choice, get the data required to calculate...
Java - Write a program to calculate a user’s BMI and display his/her weight status. The...
Java - Write a program to calculate a user’s BMI and display his/her weight status. The status is defined as Underweight, Normal, Overweight and obese if BMI is less than 18.5, 25, 30 or otherwise respectively. You need to read weight (in kilogram) and height (in metre) from the user as inputs. The BMI is defined as the ratio of the weight and the square of the height. [10 marks]
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program:...
Create a Python script in IDLE or Kali Python3 CLI to create the following Python Program: Your program will create a username of your choice using a Kali Linux command "useradd -m mark", then set the password for that user using the Kali Linux Command "echo "mark:10101111" | chpasswd". Then you create a dictionary file using the Kali Linux command "crunch 8 8 01 > mylist.txt" Your python script should crack the password for that user and display on the...
Phyton Question: You have been hired to create a program that computes that Monthly Net Pay...
Phyton Question: You have been hired to create a program that computes that Monthly Net Pay for a worker after acquiring from the user their Annual Gross Salary. The deductions that are to be considered are an Income Tax of 22.5%, a Social Security Tax of 6.2%, and a Medicare Tax of 1.45%. The program should end by displaying the Monthly Net Pay to the user. Design the algorithm for this program using your preferred method of representation (Pseudocode OR...
You are in the 28 percent income tax bracket and pay long-term capital gains taxes of...
You are in the 28 percent income tax bracket and pay long-term capital gains taxes of 15 percent. What are the taxes owed or saved in the current year for each of the following sets of transactions? a.) You buy 100 shares of ZYX for $10 and after seven months sell it on December 31, 201X, for $23. You buy 100 shares of WER for $10 and after 15 months sell it on December 31 201X, for $7. You buy...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT