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> <hourly wage> <hours worked>
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.
file_name = input('Enter input file name: ')
# print the header on terminal
print('\n%-15s%-10s%-10s' % ('Name', 'Hours', 'Total Pay'))
# open the file and iterate line by line
for line in open(file_name):
line = line.strip()
# if line is not blank
if line != '':
# split the line and capture each group
(nm, wage, hours) = line.split()
# name is in string, while wage and hours next
# to be converted form stirng to float
wage = float(wage)
hours = int(hours)
pay = wage * hours
print('%-15s%-10d%-10.2f' % (nm, hours, pay))
======================
data.txt:
Lambert 10.5 34
Osborne 6.25 22
Giacometti 100.7 5
In case of any doubts, please
ask in comments. If the answer helps you, please upvote. I am in
great need of upvotes. Thanks!
The Payroll Department keeps a list of employee information for each pay period in a text...
Programming Exercise 4.12 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. Each line should contain:...
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...
I am having a hard time with my program to assignment 4.12. Here
are the instructions:
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...
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...
You are to write a program that will process employees and their pay. For each employee the program will read in an employee’s name and hourly pay rate. It should also read in the number of hours worked each day for 5 days and calculate his or her total number of hours worked. You must read the hours using a loop. The program should output the employee’s name, gross pay, total withholding amount and net pay. Withholding is made up...
In C++ Please please help.. Assignment 5 - Payroll Version 1.0 In this assignment you must create and use a struct to hold the general employee information for one employee. Ideally, you should use an array of structs to hold the employee information for all employees. If you choose to declare a separate struct for each employee, I will not deduct any points. However, I strongly recommend that you use an array of structs. Be sure to read through Chapter...
Design a PayRoll class that has data members for an employee’s first and last name, hourly pay rate, number of hours worked. The default constructor will set the first and last name to empty string, and hours worked and pay rate to zero. The class must have mutator functions to set each of the data members of the class and accessors to access them. The class should also have the following member functions: displayPayroll function that displays all data members...
Calculate Payroll computer programmer, and an administrator. The following payroll information is available for each K. Mello Company has three employees-a consultant, employee Administrator Consultant Computer Programmer $3,110 per week Regular earnings rate $36 per hour $44 per hour Overtime earnings rate 1.5 times hourly rate Not applicable 2 times hourly rate Federal income tax withheld $930 $244 $510 For hourly employees, overtime is paid for hours worked in excess of 40 hours per week. For the current pay period,...
In C program Consider a file that contains employee records, called "empstat.txt." The data for each employee consist of the employee’s last name (up to 20 characters), employee id number (up to 11 characters), gross pay for the week (double), taxes deducted (double) for the week, and net pay (double) for the week. Create a struct to hold the employee information. Write a void function called writeEmpFile that prompts the user to enter last name, id number, gross pay and...
write this program in Java
Problem 5. (30 Points) Write a program that reads employee work data from a text file employee.txt), and then calculates payroll information based on this file and store them into a new text file called payroll.txt. The employee. txt file contains one line of text for each employee. Each line consists of the following data (delimited by tabs): employee's name, employee's hourly wage rate, hours worked Monday, hours worked Tuesday, hours worked Wednesday, hours worked...