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

The program you will be writing displays a weekly payroll report. A loop in the program...
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, last name, worked hours, hourly pay rate, state tax and federal tax rate. After data in entered and the user hits the enter key, the program will calculate gross an net pay, then displays all employee's payroll information, and ask for the next employees' information. if worked hour is more than 40, double pay the hours...
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...
Please drow Flow chart The program you will be writing displays a weekly payroll report. A...
Please drow Flow chart 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...
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...
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....
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.
C++ while loop Exercise Write a program that continues to ask the user to enter any...
C++ while loop Exercise Write a program that continues to ask the user to enter any set of numbers, until the user enters the number -1. Then display the total sum of numbers entered and their average. (note that you need to define a counter that counts how many numbers so the average = (sum/n) where n is your counter total. #include <iostream> using namespace std; int main() { int number, n=0, sum=0; cout << "Enter a number to start...
Write a program that calculates the area and circumference of a circle. It should ask the...
Write a program that calculates the area and circumference of a circle. It should ask the user first to enter the number of circles n, then reads the radius of each circle and stores it in an array. The program then finds the area and the circumference, as in the following equations, and prints them in a tabular format as shown in the sample output. Area = πr2 , Circumference = 2πr, π = 3.14159 Sample Output: Enter the number...
Write a Python program that computes the income tax for an individual. The program should ask...
Write a Python program that computes the income tax for an individual. The program should ask the user to enter the total taxable income for the year. The program then uses the tax bracket (as shown below) to calculate the tax amount. This is based on a progressive income tax system which is how income tax is calculated in the U.S. As a result, this for example means that only income above $500,001 is taxed at 37%. Income of lower...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT