IUP Computer Science
COSC 110    Spring 2008

Project #4
(Watermelon Contest)
(Due 21 March 2008)

Each year at the Texas State Fair, there is intense competition to win the title of Best Watermelon Grower.  Because of claims of bias in the past, a new scoring system has been devised to try to make the competition more objective.  Each participant is required to use a fake name, so the judges do not know who they are.  In addition, each participant must submit 3 to 6 of their best melons for judging - the participant chooses exactly how many.  Scoring is based on the weights, appearance, and taste of the melons.  Appearance and taste are rated on a scale from 0 to 100; the weight score should also come out to be less than 100.  A file named watermelon.txt  has been created which contains the pertinent information about each participant's entries.  Each line of the file contains the information about one participant in the form:

Fake-name  No.-of-melons  list-of-melon-weights  appearance-rating  taste-rating

Here are the first few lines of the file:

Alice        6    51.7    60.9    50.4    60.3    61.6    61.0   83   85
Arthur       5    51.0    50.2    54.2    60.7    58.4   74   93
Billy        3    44.2    42.8    42.9   89   95

Here Alice has submitted 6 watermelons, Arthur 5 and Billy 3.  The weights for each melon follow; after that, is the appearance rating (83 for Alice) and taste rating (85 for Alice).

The weights are used to calculate the objective component of the overall score.  The calculation works like this.  First the average weight is calculated for a participant.  In the case of Alice, the average weight is 57.65 pounds.  This is then multiplied by the entry factor.  If a participant enters x watermelons, the entry factor is 1.x  Thus, for Alice, the entry factor is 1.6; for Arthur, it would be 1.5; and for Billy, it is 1.3.  When the average weight is multiplied by the entry factor for Alice, we get 92.24; this number is then rounded off to get a weight score of 92.  Alice's overall score is then the weight score + the appearance rating + the taste rating or 260.  Similarly, Arthur's weight score is 82 and his overall score is 249.

You are to write a program that does each of the following tasks.

  1. Displays a table (with column labels) showing the name, weight score, appearance rating, and taste rating for each participant in the contest.
  2. Displays the name and overall score of the person who is the Best Watermelon Grower, as well as the name and overall score for the people in second and third place.
  3. Displays the name and weight score of the winner of the Melon-Lite Award, the one who has the lowest weight score.
  4. Displays the name and appearance rating of the winner of the Ugly Gourd Award, the one that has the lowest appearance rating.
  5. Displays the name and taste rating of the winner of the Mr./Ms Yuck Award, the one that has the lowest taste rating.
  6. Displays the name and overall score of the winner of the Dead Last Award, the one that has the lowest overall score.
You are required to use at least one additional function, besides main, in this program.  The required function must be named UpdateLow.  It should be designed to update an integer value and the associated name in determining a minimum.  You should find good use for this function in the program.

The data file for the program, watermelon.txt can be found on the I:\ drive in I:\jlwolfe\110\watermelon.txt

Hand in a well-documented printout of your program and a printout of the captured output described above.  Also, copy the program's .cpp file to the handin folder on the P: drive for COSC 110, your section.  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 wolfep4.cpp

Here is a sample of part of the table output you should get.

Pseudonym       Weight   Appearance   Taste
Alice               92        83        85
Arthur              82        74        93
Billy               56        89        95

The column labels you use may be different.   Explanatory text for the other displays may also vary from mine but still needs to identify the result being displayed.  Here are a couple of award winners.

Ugly Gourd Award Winner:  Boopsie with an appearance rating of 71
Mr./Ms. Yuck Award Winner:  Daisy with a taste rating of 75