Question

In: Computer Science

. 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 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 teststhe function by asking the user to enter hours and

number of workers and prints the total number of pieces produced.

A sample run:

Time of the day: 6

Number of workers: 10

The total number of pieces produced:300

Or

Time of the day: 35

Number of workers: 10

Can not perform the calculation

• test your program with 3 different data than the examples, you may assume that the user will

only enter numbers.

• Copy the results to testing.txt.

Solutions

Expert Solution

Program code in to1.py:

def pieces_produced():
    time=int(input("\nTime of the day:"))
    workers=int(input("Number of workers:"))
    if(workers<0):
        print("Number of workers should be non-negative value....")
        pieces=-1
    else:
        if(time>=6 and time<10):
            pieces=30*workers
        elif(time>=10 and time<14):
            pieces=40*workers
        elif(time>=14 and time<=18):
            pieces=35*workers
        else:
            pieces=-1
            print("Time is not valid...It should be between(6-18)")
    return pieces
for i in range(3):
        value=pieces_produced();
        if(value==-1):
            print("Can not perform calculation.")
        else:
            print("The total number of pieces produced:",value)

Data in testing.txt:

>>>
= RESTART: C:/Users/Sappati Praveena/AppData/Local/Programs/Python/Python38-32/to1.py

Time of the day:18
Number of workers:23
The total number of pieces produced: 805

Time of the day:5
Number of workers:-3
Number of workers should be non-negative value....
Can not perform calculation.

Time of the day:20
Number of workers:5
Time is not valid...It should be between(6-18)
Can not perform calculation.
>>>


Related Solutions

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...
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...
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.
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...
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?
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...
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. 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...
Discuss the problems of measuring productivity in actual work situations. How might productivity be measured for...
Discuss the problems of measuring productivity in actual work situations. How might productivity be measured for each of the following industries? a. Education(e.g.,elementaryandsecondaryeducation,highereducation—undergraduate and graduate) b. Government (e.g., the Social Security Office, the Internal Revenue Service) c. Manufacturing (e.g., soap and toothpaste, computers, heavy machinery) d. Finance and insurance (e.g., banks, insurance companies, brokerage houses)
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT