Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Python Assignment: Write a Python program to exercise your understanding of lists. Display any numerical output with 2 digits after the decimal point You can

Python Assignment: Write a Python program to exercise your understanding of lists. Display any numerical output with 2 digits after the decimal point You can use \\t in your print statement for a tab spacing in the output Process: Write a Python program to process employee data. Suppose we have the following sample data for several employees and their hours worked for each day of the week (I only showed 3 days of the week here). Name Sunday Monday Tuesday

Duck 0 8.5 11 Goofy 4 10 5 Micky 10.9 8 8 Mini 8 0 10 We like to be able to allow the user to input the number of employees and the number of days of the week and ask for the number of hours the employee worked and store data in a 2-d list. Note that the list only stores the number of hours worked. We will use a one-d list to store the employee names. 1. Ask the user for the number of employees to process 2. Validate the number of employees to make sure its a number between 1 and 10 3. Ask the user for the number of days of the week and make sure its a number between 1 and 7. 4. Ask the user for the name of employees and use a list to store the employee names 5. Ask the user for hours worked and store in a 2-dimensional list 6. Calculate the total hours worked by each employee and store it in another list 7. Calculate the total hours worked for each day of the week and store it in another list 8. Display the header EMPLOYEE REPORT 9. Display the name, hours worked, total hours worked for each employee, and the total number of hours worked for each day of the week in a tabular format as shown in the sample run. 10. Ask the user for an employee name and display the total hours worked and total pay based on a rate of $15 per hour. If the student is not in the list, issue an error message. Make sure to continuously ask the user for input until the user wishes to stop. I can define a 2-dimensional list with 10 rows and 7 columns all with hours worked of 0 as: hours = [[0 for c in range(7)] for r in range(10)] Sample Interaction: Note that this is just a sample test case. Your code should work for any set of input. I did not show a sample run with invalid input, but you should test for invalid input. Your user interaction and output display must be like what is shown in the sample run. NOTE: To test your code, you can always try smaller numbers for input. For example, you can use numbers such as 1, 2, 3, etc. for the hours worked as you test your code incrementally. Sample test run: Enter the number of employees: 3 Enter the number of weekdays for hours worked: 4 Enter employee name: Duck Enter employee name: Goofy Enter employee name: Micky Enter hours worked for Duck : 0 Enter hours worked for Duck : 8.5 Enter hours worked for Duck : 11 Enter hours worked for Duck : 5 Enter hours worked for Goofy : 4 Enter hours worked for Goofy : 10 Enter hours worked for Goofy : 5.7 Enter hours worked for Goofy : 12 Enter hours worked for Micky : 8 Enter hours worked for Micky : 8 Enter hours worked for Micky : 5.5 Enter hours worked for Micky : 2 EMPLOYEE REPORT Duck 0.00 8.50 11.00 5.00 24.50 Goofy 4.00 10.00 5.70 12.00 31.70 Micky 8.00 8.00 5.50 2.00 23.50 Total: 12.00 26.50 22.20 19.00 Enter the name of an employee (enter done to exit): Goofy Total hours worked for Goofy : 31.70 Pay: 475.50 Enter the name of an employee (enter done to exit): bob bob not found in my list Enter the name of an employee (enter done to exit): Micky Total hours worked for Micky : 23.50 Pay: 352.50 Enter the name of an employee (enter done to exit): done

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

Java An Introduction To Problem Solving And Programming

Authors: Walter Savitch

8th Edition

0134462033, 978-0134462035

More Books

Students also viewed these Programming questions

Question

Discuss the purpose of a chargemaster.

Answered: 1 week ago

Question

6. How can team members successfully resolve conflict?

Answered: 1 week ago

Question

5. What is ethnocentrism? How can it be overcome in communication?

Answered: 1 week ago