IUP Computer Science
COSC 110     Fall 2007

Project #5
Efficient Apple Picking
(Due 14 November 2007)

Professor Jones teaches statistics at Whatsamatta University; but he also owns and operates an apple orchard.  Each fall, Jones hires a bunch of farm workers to help pick the apple crop; this job usually lasts four or five weeks.  Unlike most apple orchard operators, Prof. Jones does not use mechanical pickers and does not pay the workers on a "per bag" basis.  Instead, he pays them an hourly wage and offers the possibility of a bonus for exceptional work.  Each bag holds about 1 1/2 bushels.

Prof. Jones runs the operation like this.  Each day, the number of bags of apples that each worker has picked is kept track of.  At the end of two weeks (10 days of picking), Jones evaluates the workers.  He calculates the total number of bags each worker has picked for each week and for the two weeks together.  He then calculates the average (mean) number of bags picked by a worker for the two weeks and the standard deviation for the two-week totals for the workers.  He then categorizes the workers into four groups:  1) Those whose two-week bag count is more than one standard deviation above the mean (these workers are to be paid a bonus); 2) Those whose two-week bag count is more than one standard deviation below the mean (these workers are to be fired - unless they meet the exception criteria); 3) Those who would normally be fired but are showing significant improvement, defined as picking at least 5 bags more in the second week than in the first week (these workers are put on probation for another week); and 4) All workers who do not fit into one of the first three categories are regarded as average.

You are to write a program to help Prof. Jones with his calculations.  The file  apples.txt  which is on the I: drive as I:\jlwolfe\110\apples.txt   contains the information about the first two weeks of apple picking.  Each line of the file has the following form:

Lastname, Firstname        Ten-numbers-representing-the-bags-picked-each-day

Here are the first few lines of the file:

Alligator, Albert          10   8  11  12   9   5   7   5   5   5
Bailey, Beetle              7  10  13  16   7   9   7   9   7   8
Blossom, Auntie            10   0   2   7   0   9   9   9  11   8
Boopstein, Barbara          8   9   2   6  11   7   6  12   7   5
Brenner, Zeke               9  10  12   4  11   9   2   0  10   0

Even within these few lines, we can see at least one person in each category.  Beetle Bailey has picked 93 bags and will get a bonus; Zeke Brenner has picked 67 bags and will be fired because his total is too low; Auntie Blossom has only picked 65 bags but has picked 27 more bags in the second week than the first - she will be on probation; and Albert Alligator and Barbara Boopstein are average workers.

Your program is to do the following.

Your program must include at least two functions in addition to main.  I recommend making functions to do the following:  get the number of bags a worker picks for one week; calculating the standard deviation; deleting a worker who is to be fired or displaying any of the lists of workers (those eligible for a bonus, those on probation, or the final display of those returning)..

Hand in a well-documented printout of your program and a printout of the captured output, showing all of the listings specified above.  Also, copy the program's .cpp file to the handin folder on the P: drive for COSC 110 section 003.  Be sure to name the .cpp file after yourself so that it can be distinguished from other student file names.  For example, I would name my file wolfep5.cpp
 

Extra Credit:  Keep track of each worker who will be paid a bonus and each worker who will be placed on probation.  When the final listing is made showing names and two-week totals, mark the name of each person to get a bonus with an asterisk (*) and mark the name of each person on probation with a question mark (?).  The final listing might then begin like this (including the extra credit marks):

 Name                       Bags
 Alligator, Albert            77
*Bailey, Beetle               93
?Blossom, Auntie              65
 Boopstein, Barbara           73
 

The standard deviation is calculated with the formula at the right    in which n is the number of workers and x is the total number of bags a worker has picked during the two weeks.  So, take n times the sum of the squares of the total bags for each worker and subtract from it the square of the sum of the total bags; then, divide by the product of n times n-1.