Question

In: Computer Science

Write a program that displays a weekly payroll report. A loop in the program should ask...

Write a program that displays a weekly payroll report. A loop in the program should ask the user for the employee number, gross pay, state tax, federal tax, and FICA withholdings. The loop will terminate when 0 is entered for the employee number. After the data is entered, the program should display totals for gross pay, state tax, federal tax, FICA withholdings, and net pay.

Input Validation: Do not accept negative numbers for any of the items entered. Do not accept values for state, federal, or FICA withholdings that are greater than the gross pay. If the sum of state tax + federal tax + FICA withholdings for any employee is greater than gross pay, print an error message and ask the user to reenter the data for that employee.

IN PYTHON PLEASE!

Solutions

Expert Solution

Code:

while True:
employeeNumber=int(input("Enter employee number: "))
if (employeeNumber==0):
break
grossPay=float(input("Enter gross pay: "))
if (grossPay<0):
grossPay=float(input("Gross pay should be positive: "))
stateTax=float(input("Enter state tax: "))
if (stateTax<0 or stateTax>grossPay):
grossPay=float(input("State tax should be positive and less than gross pay: "))
federalTax=float(input("Enter federal tax: "))
if (federalTax<0 or federalTax>grossPay):
federalTax=float(input("Federal tax should be positive and less than gross pay: "))
ficaHoldings=float(input("Enter FICA holdings: "))
if (ficaHoldings<0 or ficaHoldings>grossPay):
ficaHoldings=float(input("FICA holdings should be positive and less than gross pay: "))
netPay=grossPay-stateTax-federalTax-ficaHoldings
print("Employee Number: {}".format(employeeNumber))
print("Gross Pay: {}".format(grossPay))
print("State Tax: {}".format(stateTax))
print("Federal Tax: {}".format(federalTax))
print("Net Pay: {}".format(netPay))

  

Screenshot of Code:

Screenshot of Output:


Related Solutions

Using Java, The program you will be writing displays a weekly payroll report. A loop in...
Using Java, The program you will be writing displays a weekly payroll report. A loop in the program should ask the user for the employee’s number, employee’s last name, number of hours worked, hourly pay rate, state tax, and federal tax rate. After the data is entered and the user hits the enter key, the program will calculate gross and net pay then displays employee’s payroll information as follows and asks for the next employees’ information. if the user works...
General Description: Write a program that processes weekly payroll for a small company. The program starts...
General Description: Write a program that processes weekly payroll for a small company. The program starts with printing a logo then asking for the total number of employees for the week. The program then inputs data for each individual employee and prints a paystub. At the end, it prints a report based on data for all employees. Gross Pay: The company has two types of employees: Hourly and Salaried - Hourly employees have an hourly wage, and are paid overtime...
Write a program that uses a while loop with a priming read to ask the user...
Write a program that uses a while loop with a priming read to ask the user to input a set positive integers. As long as the user enters a number greater than -1, the program should accumulate the total, keep track of the number of numbers being entered and then calculate the average of the set of numbers after the user enters a -1. This is a sentinel controlled-loop. Here is what a sample run should look like: Enter the...
Write a Python program that has a loop to continuously ask the user for a number,...
Write a Python program that has a loop to continuously ask the user for a number, terminating the loop when the number entered is -1. Inside the loop, 1.) display one asterisk(*) if the number is 1, 2.) two asterisk(**) if the number is 2 and 3.) "OTHER" if the number is any other number.
Ask the user how many days that they collected gems. A loop you write should loop...
Ask the user how many days that they collected gems. A loop you write should loop how many days the user enters. If the user enters 5 days, then the loop should loop 5 times to collect the data from each day. So, each loop iteration represents a day. In each loop iteration, ask the user how many gems they collected that day. After the loop finishes gathering the data for each day, calculate the total and average gems collected....
what should this program do? Write a program (Lab8.cpp) that will ask the user for two...
what should this program do? Write a program (Lab8.cpp) that will ask the user for two file names. You will read the characters from each file and put them in separate queues. Then, you will read each character from each queue and compare it. If every character from both queues is the same, you will print “The files are identical.” Otherwise, you will print “The files are not identical.” Step-by-Step Instructions Create a character queue (named queue1) using the Standard...
Please use Phyton to write a program: Write a program that calculates and displays the total...
Please use Phyton to write a program: Write a program that calculates and displays the total bill at a restaurant for a couple that is dining. The program should collect from the couple, cost of each meal, and the percentage of the final cost that they would like to tip. The sales tax in the state where the restaurant exists is 7.5%. Display to the user, line by line: Total Cost of Both Meals Sales Tax in dollars Tip in...
Bonus Homework for Week 5 Preparing a Weekly Payroll Report Employee Name Gross Weekly Pay State...
Bonus Homework for Week 5 Preparing a Weekly Payroll Report Employee Name Gross Weekly Pay State Withholding Tax Federal Withholding Tax Net Pay Sue Smith $800 ________________ ________________ Tom Brown $300 ________________ ________________ Mary Wilson $250 ________________ ________________ James Jackson $100 ________________ ________________ John Sinatra $600 ________________ ________________ Betty Rockford $1,255 ________________ ________________ Similar assignment as our in-class IF function work - you must calculate the amount of State Withholding Tax and Federal Withholding Tax. Also calculate Net Pay. Watch-out...
every code should be in java Program 1: Write a while loop that sums the integers...
every code should be in java Program 1: Write a while loop that sums the integers from 1 to 10, excluding 3 and 6. Print the sum. [Hint: Use logical operators] Program 2: Write a for loop that attempts to display the numbers from 1 to 10, but terminates when the control variable reaches the value 6. Program 3: Write a do...while loop that prints the integers from 10 to 0, inclusive.
Assembly Language for x86 processors You are to write a program which should first ask for...
Assembly Language for x86 processors You are to write a program which should first ask for 4 random numbers from 0-20 (user will inpute these numbers in no preset order). Input these 5 numbers in variables called num1, num2, num3, num4, and num5. When done, your program should sort these numbers (you will use lots of conditions to check order). num1 should contain smallest number while num5 should contain the biggest. display the contents of num1 through num5 on the...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT