How to read this csv file and compute the regular time pay and overtime pay. In Python please.
Thanks for the question.
Here is the completed code for this problem. Comments are included
so that you understand whats going on. Let me know if you have any
doubts or if you need anything to change.
Thank You !!
Update the below line to point to the csv file in your laptop.
filename='F:\\pay.csv'
=============================================================================
import os # to check if the file is valid def read_csv_file(filename): if os.path.isfile((filename)) is not True:return None with open(filename,'r') as infile: employee_data=[] # reads the data from file and store it in the list for line in infile.readlines()[1:]: line=line.strip().split(',') line=[float(data) for data in line if len(data)>0] employee_data.append(line) return employee_data # returns the data to the main function def main(): filename='pay.csv' # update this line to point to the csv file employee_data = read_csv_file(filename) if employee_data==None: print('Unable to read file :{}, Please check the file is valid.'.format(filename)) return print('{0:<15} {1:<15} {2:>15} {3:>15} {4:>15}'.format('Regular Hrs','Overtime Hrs','Pay Rate',\ 'Regular Pay','Overtime Pay')) for employee in employee_data: regular_hrs=employee[0] overtime_hrs=0 if regular_hrs>40: # calculate overtime hours overtime_hrs=regular_hrs-40 regular_hrs=40 rate=employee[1] print('{0:<15.2f} {1:<15.2f} {2:>15.2f} {3:>15.2f} {4:>15.2f}'.\ format(regular_hrs,overtime_hrs,rate,regular_hrs*rate,overtime_hrs*rate*1.5)) main()
====================================================================================
How to read this csv file and compute the regular time pay and overtime pay. In Python please. Pay 65 35 43 19.43 Hours 8.75 Pay 65 35 43 19.43 Hours 8.75
Create a Text file containing the following data (without the headings): Name Wage Hours Callaway, G 16.00 40 Hanson, P 15.00 48 Lasard, D 16.50 35 Stillman, W 18.00 50 Write a C++ program that uses the information in the file to produce the following pay report for each employee: Name, Pay Rate, Hours, Regular Pay, Overtime Pay, Gross Pay Compute regular pay as any hours worked up to and including 40 hours multiplied by the pay rate. Compute overtime...
Design a program(Creating a RAPTOR flowchart) that will read a file of employee records containing employee number, employee name, hourly pay rate, regular hours worked and overtime hours worked. The company pays its employees weekly, according to the following rules: regular pay = regular hours worked × hourly rate of pay overtime pay = overtime hours worked × hourly rate of pay × 1.5 total pay = regular pay + overtime pay Your program is to read the input data...
Art receives a semi-monthly salary of $906.61 and works a regular workweek of 35 hours. (a) What is Art's hourly rate of pay? (b) If Art's gross earnings in one pay period were $1023.17, for how many hours of overtime was Art paid at time-and-a-half regular pay? (a) The hourly rate of pay is $( (Round to the nearest cent as needed.)
Casey receives an annual salary of 517,472.00, is paid monthly, and works 35 regular hours per week. Overtime is paid at time-and-a-half regular pay. (a) What is Casey's gross remuneration per pay period? (b) What is his hourly rate of pay? (c) How many hours overtime did Casey work during a month for which his gross pay was $1693.60? (a) Casey's gross remuneration per pay period is $] (Type an integer or a decimal) (b) Casey's hourly rate of pay...
Sheila Williams, a medical secretary, earns $3,575 monthly for a 35-hour week. For overtime work, she receives extra pay at the regular hourly rate up to 40 hours and time and one-half beyond 40 hours in any week. During one semimonthly pay period, Williams worked 10 hours overtime. Only 2 hours of this overtime were beyond 40 hours in any one week. Compute the following amounts. Round all divisions to two decimal places and use the rounded amounts in subsequent...
Mike Dooley's regular hourly wage is $16 an hour. He receives overtime pay at the rate of time and a half. The FICA tax rate is 7.65%. Mike is paid weekly. For the first pay period in January, Mike worked 49 hours. All hours over 40 earn the overtime rate. Mike's federal income tax withholding is $150 and his state income tax withholding is $60. Mike has authorized that $25 be withheld from his check each pay period for savings...
Hemal Thomas is an employee in British Columbia. The net pay calculation is for the first biweekly pay of 2015. The employee is 32 years old and in this pay is entitled to 70 hours’ regular pay at $20.00/hour, three hours of overtime at time and a half, and a $100.00 safety shoe allowance. The employee also receives a monthly car allowance of $200.00 and the employer pays group life insurance of $35.00 a month. Vacation at 4% is accrued.The...
Python 3 Question Please keep the code introductory friendly and include comments. Many thanks. Prompt: The owners of the Annan Supermarket would like to have a program that computes the weekly gross pay of their employees. The user will enter an employee’s first name, last name, the hourly rate of pay, and the number of hours worked for the week. In addition, Annan Supermarkets would like the program to compute the employee’s net pay and overtime pay. Overtime hours, any...
I am not sure what i did wrong here: 2,414/ month 35 hour work week 2,414*12= 28,968 Annual 28,968/52= 557.08 Weekly 557.08/35= 15.92 Hourly 15.92*1.5= 23.87 OT 10 extra hours 2 are over 40 so 8 reg 2 OT 8*15.92= 127.33 2*23.87= 47.75 OT 1207+127.33+47.75= 1382.08 However this is wrong ... what did I do wrong please advise. Sheila Williams, a medical secretary, earns $2,414 monthly for a 35-hour week. For overtime work, she receives extra pay at the regular...