Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

INSTRUCTIONS: Individual Problem: Process employee payroll Write a program that will accept input about employees and their hours worked and payrates from the user until

INSTRUCTIONS:

Individual Problem: Process employee payroll

Write a program that will accept input about employees and their hours worked and payrates from the user until they press enter by itself.

The input is of the form: a employee number, then two number of hours worked for a week and the payrate per hour all on the same line. All data is delimited by commas. Your program can assume there is always this much data on each line.

The program finds the amount of the employee's paycheck by adding the two hours together and multiplying by the pay rate. The result should be rounded to 2 places. Any of the input numbers can be a floating point. The program creates a list in which each entry is a 2-element list, the employee number and this paycheck. It looks like [[12345, 35.0], [45214, 1101.0], [23145, 250.75], ...]

This requires sentinel logic.

When the input is completed, then the program prints out the information in the new list, in two columns.

After the table of paychecks, the program should also produce how many employees were processed, the total amount of the payroll (how much everyone together gets paid) (rounded to 2 places) and the average amount of a paycheck (rounded to 2 places). The program should work no matter how many or how few employees are input. Make sure your code never divides by zero but gives a zero average.

You do not have to worry about "overtime" (working more than 40 hours a week).

Note that the Employee ID should not be cast as a number. It is purely a label, an identifier. It is not going to be involved with the arithmetic, so it can stay as a string.

Sample output

Enter Employee ID, hours worked in week 1, hours worked in week 2 and payrate separated by commas ID, week 1, week 2, payrate separated by commas: 111, 38, 42, 17.50 ID, week 1, week 2, payrate separated by commas: 2222, 42, 45, 21 ID, week 1, week 2, payrate separated by commas: 333, 18.5, 22.5, 15 ID, week 1, week 2, payrate separated by commas: Employee ID Check Amount 111 1400.0 2222 1827.0 333 615.0 Total Payroll $3842.0 Number of Employees: 3 Average pay check $1280.67 

Another Sample Output (no employees)

Enter Employee ID, hours worked in week 1, hours worked in week 2 and payrate separated by commas ID, week 1, week 2, payrate separated by commas: Employee ID Check Amount Total Payroll $0 Number of Employees: 0 Average pay check $0.0

PLEASE HELP ME WRITE THIS CODE IN PYTHON VERSION 3!!

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Expert Oracle Database Architecture

Authors: Thomas Kyte, Darl Kuhn

3rd Edition

1430262990, 9781430262992