2d Array Assignment
2d Array Assignment
Assignment
1
5 A firm employs workers who assemble amplifiers. Each member of staff works an agreed number
of hours each day.
The firm records the number of completed amplifiers made by each employee each day.
Daily hours
worked Production data
Worker 1 5 Worker 1 Worker 2 Worker 3
Worker 2 10 Day 1 10 20 9
Worker 3 10 Day 2 11 16 11
Day 3 10 24 13
Day 4 14 20 17
............................................................................................................................ ............
[2]
...........................................................................................................................................
1 ........................................................................................................................................
...........................................................................................................................................
2 ........................................................................................................................................
.......................................................................................................................................[2]
.......................................................................................................................................[1]
...........................................................................................................................................
.......................................................................................................................................[2]
FOR WorkerNum 1 TO 3
WorkerTotal[WorkerNum] 0
ENDFOR
FOR WorkerNum 1 TO 3
FOR DayNum 1 TO 4
WorkerTotal[WorkerNum] WorkerTotal[WorkerNum] +
ProductionData[DayNum, WorkerNum]
ENDFOR
ENDFOR
FOR WorkerNum 1 TO 3
WorkerAverage WorkerTotal[WorkerNum]/
(4 * DailyHoursWorked[WorkerNum])
IF WorkerAverage < 2
THEN
OUTPUT “Investigate“, WorkerNum
ENDIF
ENDFOR
WorkerTotal
WorkerNum DayNum WorkerAverage OUTPUT 1 2 3
[8]