Question

In: Computer Science

my program should work for ANY NUMBER OF WORKERS..after all worker gross and net pay have...

my program should work for ANY NUMBER OF WORKERS..after all worker gross and net pay have been calculated, you should display the total number of workers, the total gross pay, and the total net pay.

Employee ID

Employee Name

The number of hours worked

The Employees hourly wage…

i used while loop

EmpName= input(str("PLease enter Employee name: or press -1 to exit: "))

while EmpName != "-1":

EmpID= input("Enter Employee ID: ")

how do i write this in a list form? if i enter 5 employee names, the program has to calcalate how many employees and total pays?

pls help

thanks

Solutions

Expert Solution

Java code pasted below.

#Initialize totalgrosspay and totalnetpay to 0
totalgrosspay=totalnetpay=0
#Initialize an empty list
emplist=[]
while True:
#Reading all the details for the employee
empid=input("Enter Employee ID:")
empname=input("Enter Employee Name:")
hours=int(input("Enter the number of hours worked:"))
wages=int(input("Enter hourly wages:"))
deductions=int(input("Enter the amount for deductions:"))
#calculating grosspay and netpay
grosspay=hours*wages
netpay=grosspay-deductions
#Add the details as atuple to the list called emplist
emplist.append((empid,empname,hours,wages,deductions,grosspay,netpay))
#calculating total grosspay and total net pay for all employees
totalgrosspay=totalgrosspay+grosspay
totalnetpay=totalnetpay+netpay
t=input("Enter -1 to exit or press enter to continue:")
if t=="-1": break
print()
print("Total number of employees:",len(emplist))
print("Total Gross Pay of all Employees:",totalgrosspay)
print("Total Net Pay of all Employees:",totalnetpay)
print()
print("EmpID\tName\tHours worked\tWages\tDeductions\tGross pay\tNet pay")
for i in range(0,len(emplist)):
print(emplist[i][0],"\t",emplist[i][1],"\t",emplist[i][2],"\t\t",emplist[i][3],"\t\t",emplist[i][4],"\t",emplist[i][5],"\t\t",emplist[i][6])

Java code in IDLE pasted for better understanding of the indent.

Output Screen


Related Solutions

Develop a C++ program that will determine the gross pay and net pay (after taxes). Each...
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each employee pays a flat tax of 150.00 on the first 1000.00 dollars earned. If the employee earns less than 1000.00 dollars then he/she pays no taxes. Taxes are computed at 15.5% on all earnings over 1000.00 dollars if the number of dependents is 3 or less and 12.5% if the number of dependents are 4 or more. Sample input/outpt dialog Enter # of yours...
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:...
Develop a C++ program that will determine the gross pay and netpay (after taxes). Each...
Develop a C++ program that will determine the gross pay and net pay (after taxes). Each employee pays a flat tax of 150.00 on the first 1000.00 dollars earned. If the employee earns less than 1000.00 dollars then he/she pays no taxes. Taxes are computed at 15.5% on all earnings over 1000.00 dollars if the number of dependents is 3 or less and 12.5% if the number of dependents are 4 or more.
After all the subsidies are added, what is the starting pay of McDonald’s workers in Denmark?...
After all the subsidies are added, what is the starting pay of McDonald’s workers in Denmark? What other benefits do workers in Denmark receive? What might be an opportunity cost of high wages in Denmark?
Write a java program to accept a telephone number with any number of letters. The output should display a hyphen after first 3 digits and subsequently a hyphen (-) after very four digits.
Write a java program to accept a telephone number with any number of letters. The output should display a hyphen after first 3 digits and subsequently a hyphen (-) after very four digits. Also, modify the program to process as many telephone numbers as the user wantscode optimization: no unnecessary variables , if statements and counterssample output screen shown with 3 cases(atleast one with blank spaces ect.)Descriptive block and inline comments include.
how to solve this question step by step. Calculate the number of workers that should have...
how to solve this question step by step. Calculate the number of workers that should have been available to process the July claims, and show all work. Standard time for processing per claim (simple claim)=36 minutes Standard time for processing per claim (complex claim)=1.25 hours Expected work hours per day 7.5 hours Compensation cost per employee= $135 per day Total working days=20 The number of July processed claims (simple)=3000 The number of July processed claims (complex)=960
write a c++ program to read two matrices with any size. Your program should have at...
write a c++ program to read two matrices with any size. Your program should have at least the following functions Main() Read a Matrix Add two matrices Subtract two matrices multiply two matrices display a matrice
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...
Problems Background work with multidimensional arrays. Your C program should enable the end-user to create any...
Problems Background work with multidimensional arrays. Your C program should enable the end-user to create any 2D matrix of n number of rows and m number of columns. The end-user could either use random numbers to initialize the matrix data or enter the values of his/her matrix using standard​ input methods such as a keyboard. After setting up the matrix data using an automated random method or manual method, the end-user could perform any following operations. We will use the...
1. Do you think all workers – including government employees- should have the right to form...
1. Do you think all workers – including government employees- should have the right to form unions? Explain. 2. Should public service employees receive roughly the same pay and benefits earned by comparable workers in the private sector? What about firefighters and police who face danger in their daily lives? 3. Do you support the position taken by Governors Kasich and Walker to reduce union power? Or do you side with these unions and want to see them remain strong?...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT