Question

In: Computer Science

1. A manufacturing company measured the productivity of its workers and found that: • between the...

1. A manufacturing company measured the productivity of its workers and found that:
• between the hours of 6am and 10am they could produce 30 pieces/hour/worker
• between 10am and 2pm they could produce 40 pieces/hour/worker
• between 2pm and 6pm they could produce 35 pieces/hour/worker.
Write a function pieces_produced takes a number that represents a starting hour between 6am
and 6pm, in twenty-four hour format (between 0 and 23), along with the number of workers and
returns a number that represents the total number of pieces produced during that hour. If the
user enters an invalid hour or number of workers, the function should return -1. Save the function
in a PyDev library module named functions.py
Write a testing program named t01.py that tests the function by asking the user to enter hours and
number of workers and prints the total number of pieces produced.

Solutions

Expert Solution

The program for above question is given below with comments and output screenshots......

Explanation is in the comments ....

However i didn't include the last hours of time slot that means if time is 10am then it won't go in 6am to 10am slot...but it will go in 10am to 2pm slot .....and i guess that was expected..since the hour begins at 10am

I hope it works for you :)!!!!!!!!!!!!

ask for any help if needed !

*********************Program***************************

t01.py

import functions #import functions.py module

hour=int(input("Time of the Day: ")) #taking hour from user
noOfWorkers=int(input("Number of Workers: ")) #taking numberof workers from user

pieces=functions.pieces_produced(hour,noOfWorkers) #calling the pieces_produced() function in functions module
#and storing return value in pieces variable

if pieces!=-1: #if return value is not -1 then print pieces
print("The Total number of pieces produced: ",pieces)
else: #ootherwise(if return value is -1) print below statement
print("Can not perform the calculation")
functions.py


def pieces_produced(hour,noOfWorkers): #function definition with 2 parameters
if hour>=18 or noOfWorkers<=0:
return -1 #if houe or number of workers is invalid then retun -1
if hour>=6 and hour<10: #if hour is between 6am to 10am
return 30*noOfWorkers #return no of pieces produced that hour
if hour>=10 and hour<14: #if hour is between 10am to 2pm
return 40*noOfWorkers #return no of pieces produced
if hour>=14 and hour<18: #if hour is between 2pm to 6pm
return 35*noOfWorkers #return no of pieces produced

***********************Output***************************

THANK YOU!! PLEASE VOTE


Related Solutions

. A manufacturing company measured the productivity of its workers and found that: • between the...
. A manufacturing company measured the productivity of its workers and found that: • between the hours of 6am and 10am they could produce 30 pieces/hour/worker • between 10am and 2pm they could produce 40 pieces/hour/worker • between 2pm and 6pm they could produce 35 pieces/hour/worker. Write a function pieces_produced takes a number that represents a starting hour between 6am and 6pm, in twenty-four hour format (between 0 and 23), along with the number of workers and returns a number...
A manufacturing company measured the productivity of its workers and found that: between the hours of...
A manufacturing company measured the productivity of its workers and found that: between the hours of 6am and 10am they could produce 30 pieces/hour/worker between 10am and 2pm they could produce 40 pieces/hour/worker between 2pm and 6pm they could produce 35 pieces/hour/worker. Write a function pieces_produced takes a number that represents a starting hour between 6am and 6pm, in twenty-four hour format (between 0 and 23), along with the number of workers and returns a number that represents the total...
The data in this file are the differences in the productivity of workers measured before and...
The data in this file are the differences in the productivity of workers measured before and after they undertake a training program. x 3.483286 0.502139 1.182506 -0.78977 -1.23055 0.050956 -0.55935 -0.44297 -0.28723 -2.20755 -1.29574 -2.37856 1.590792 -1.07265 -0.51803 0.88382 -1.20074 -0.37303 0.046192 0.178191 3.011939 0.370306 -1.16088 0.896363 0.921949 -0.79235 -0.65858 1.442165 1.291734 -1.19235 0.77025 0.130772 0.170839 0.424066 0.144973 -2.14435 0.925843 2.61098 1.358568 1.635042 -0.39504 0.493437 -0.12331 -1.35487 0.336548 -2.47492 -2.26872 -0.25936 -0.54652 1.104589 -0.39521 3.072957 1.835252 -1.30094 2.040434 2.496305 0.567188...
Roberta wants to compare productivity, as measured by the number of customers served, among three workers....
Roberta wants to compare productivity, as measured by the number of customers served, among three workers. The number of customers served by each worker is shown below. Edward Cathy Brad 55 66 55 59 76 51 66 67 46 60 71 48 Is there a difference in the number of customers served? The level of significance is 0.01. Show all the five steps of the hypothesis testing.
Question 1 Production Rates A manufacturing company wishes to find out whether the productivity of its...
Question 1 Production Rates A manufacturing company wishes to find out whether the productivity of its workforce has increased now that they have a new machine. The factory examined the records for a random sample of 8 hours over the past month. The hourly production rates for these 8 hours were :           142      175     162     158     190     154     160     185 Suppose the production rate before the use of the new machine is 150 units per hour with a standard...
A manufacturing company for car batteries uses lead in its manufacturing process. Workers are encouraged to...
A manufacturing company for car batteries uses lead in its manufacturing process. Workers are encouraged to shower, shampoo, and change             clothes before going home to eliminate the transfer of lead to their children, but there is still concern that children are being exposed by their parents. A study is carried out to determine whether workers carry lead dust home. 33 of the workers children were selected as subjects, and a blood tests for each child determines the level of...
1. Productivity is generally measured as. Select one: a. its nominal value hold the basket constant....
1. Productivity is generally measured as. Select one: a. its nominal value hold the basket constant. b. its nominal value adjusted for inflation. c. its nominal value holding the base constant. d. its nominal value holding the quantity constant. 2. Discouraged workers are people who have. Select one: a. not looked for work in the past year but would take a job if one was offered to them. b. looked for work in the past year but have decided to...
How is labor productivity measured? What is the trend in labor productivity? How is labor productivity...
How is labor productivity measured? What is the trend in labor productivity? How is labor productivity related to economic growth? What helps and what hurts labor productivity? Can labor productivity keep growing forever?
The CEO of a large manufacturing company is curious if there is a difference in productivity...
The CEO of a large manufacturing company is curious if there is a difference in productivity level of her warehouse employees based on the region of the country the warehouse is located. She randomly selects 35 employees who work in warehouses on the East Coast (Group 1) and 35 employees who work in warehouses in the Midwest (Group 2) and records the number of parts shipped out from each for a week. She finds that East Coast group ships an...
1) Rising worker productivity means that more workers are demanded, other things being equal. When workers...
1) Rising worker productivity means that more workers are demanded, other things being equal. When workers have access to better tools, they can produce more, and when they produce more, they become more valuable to their companies. If this works, then why do some people oppose technological progress, fearing that better technology will lead to less, not more, jobs being created? 2) Suppose that you have a choice between two options. Option A - you can study four years in...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT