Question

In: Computer Science

The Payroll Department keeps a list of employee information for each pay period in a text...

The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the file is the following: Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report should be in tabular format with the appropriate header. Each line should contain: An employee’s name The hours worked The wages paid for that period. An example of the program input and output is shown below: Enter the file name: data.txt Name Hours Total Pay Lambert 34 357.00 Osborne 22 137.50 Giacometti 5 503.50 Python code please.

Solutions

Expert Solution

ANSWER -:

Code -:

# name of file from user

fname = input("Enter the of name file : ")

# open the file

fp = open(fname, "r")

# display the output

print("Name Hours Total Pay")

for line in fp.readlines():

cols = line.strip().split()

print("%s %d %.2f"%(cols[0],int(cols[1]),int(cols[1])*float(cols[2])))

# close the file

fp.close()

I attach the screenshot of the code for better understanding.

Output

Copy the code to run the program in your python IDE.

It's important to follow the code indentation properly to avoid indentation errors in your code.

If you have any doubt please comment me.


Related Solutions

in python language The Payroll Department keeps a list of employee information for each pay period...
in python language The Payroll Department keeps a list of employee information for each pay period . The format of each line of the file is the following: <lastname> < hours worked> < Income> Write a program that inputs from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report should be in tabular format with the appropriate header. Each line should contain an employee’s name, the hours...
Please write in Python 3.7.4 or Higher. The Payroll Department keeps a list of employee information...
Please write in Python 3.7.4 or Higher. The Payroll Department keeps a list of employee information for each pay period in a text file. The format of each line of the file is the following: <last name> <hours worked> <hourly wage> Write a program that inputs a filename from the user and prints to the terminal a report of the wages paid to the employees for the given period. The report should be in tabular format with the appropriate header....
Rubos Inc had the following payroll information for the pay period ending 10/31/2012. Total payroll was...
Rubos Inc had the following payroll information for the pay period ending 10/31/2012. Total payroll was $640,000. Unemployment taxes rates were 4.5% for State unemployment and .8 % for federal unemployment. . Income taxes withheld were $130,00. Union dues withheld were $36,000. Insurance premiums withheld were $24,000. Rubos also has an employee retirement plan which had contributions from employees of $14,000. Rubos matches all employee contributions with employer contributions of 50%. Prepare all necessary journal entries to record the payroll...
Internal controls 1. Any changes to employee master file information since the last payroll period are...
Internal controls 1. Any changes to employee master file information since the last payroll period are evaluated to ensure that they have been properly authorized by the appropriate personnel. 2. The output is reviewed for reasonableness prior to distribution to users. Consider the four methods of testing the operating effectiveness of controls (inquiry, observation, document examination, and re-performance). For each of the preceding controls, provide an example of how Mark's audit team might choose to test the operating effectiveness of...
Perez Company has the following information for the pay period of January 15–31. Gross payroll $20,000...
Perez Company has the following information for the pay period of January 15–31. Gross payroll $20,000     Federal income tax withheld $2,500 Social security rate 6%     Federal unemployment tax rate 0.8% Medicare rate 1.5%     State unemployment tax rate 5.4% Assuming no employees are subject to ceilings for their earnings, calculate Salaries Payable and Payroll Tax Expense. Salaries Payable $ Payroll Tax Expense $
Lee Company has the following information for the pay period of December 15–31: Gross payroll $18,387...
Lee Company has the following information for the pay period of December 15–31: Gross payroll $18,387 Federal income tax withheld $3,127 Social security rate 6% Federal unemployment tax rate 0.8% Medicare rate 1.5% State unemployment tax rate 5.4% Assuming no employees are subject to ceilings for taxes on their earnings, Salaries Payable would be recorded for a.$14,120.01 b.$18,387.00 c.$13,880.97 d.$12,740.98
Lee Company has the following information for the pay period of December 15–31: Gross payroll $15,189...
Lee Company has the following information for the pay period of December 15–31: Gross payroll $15,189 Federal income tax withheld $2,227 Social security rate 6% Federal unemployment tax rate 0.8% Medicare rate 1.5% State unemployment tax rate 5.4% Assuming no employees are subject to ceilings for taxes on their earnings, Salaries Payable would be recorded for a.$11,822.83 b.$10,881.11 c.$12,020.28 d.$15,189.00
For the payroll period ended on June 25, 2013, gross pay was $20,750, net pay was...
For the payroll period ended on June 25, 2013, gross pay was $20,750, net pay was $12,000, FICA tax withholdings were $3,500, income tax withholdings were $4,200, and medical insurance contributions were $1,050.
List department name, employee id, and employee name for all employees in department name order. Repeat...
List department name, employee id, and employee name for all employees in department name order. Repeat for department #10 only. List the course ID, course name, section, instructor name, day, time, and room for all course sections. List the course ID, course name, section, student ID, and student name for CRN 1003. Display the list in ascending order of student last and first names. DROP TABLE registration; DROP TABLE sections; DROP TABLE courses; DROP TABLE students; DROP TABLE instructors; CREATE...
Develop an algorithm to implement an employee list with employee ID ,name designation and department using...
Develop an algorithm to implement an employee list with employee ID ,name designation and department using link list and perform the following operation on the list i)add employee details based on department ii)remove employee details iv)count the number of employee in each department
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT