IUP Computer Science
Spring 2006

Project #5
Scavenger Hunt
(Due 12 April 2006)



The big annual scavenger hunt has just completed.  This year, there were more teams than ever, although there were fewer than the goal of 150.  The teams searched for two days to find the required items and brought their finds to the judges who verified that they were the correct items.  The judges then recorded the results in the file  finds.txt  You are to write a program to evaluate these results in several ways.  To do this, your program needs to use the information in the file  huntitems.txt  This file contains a list of the items the scavengers are to find and the number of points each item is worth.  The file begins as follows:

clothespin          5
hardbound-Hamlet    20
pocket-watch        15
child's-toothbrush  5
Wendy's-coupon      8
African-mask        36

Multi-word items have hyphens connecting the words so that each item may be treated as a single string.  The numbers show the points awarded for finding the item; each item is worth less than 100 points.  A team can get credit for an item only once.  There are fewer than 50 items in the  huntitems.txt  file. Your program is allowed to read the huntitems.txt file only once.

For each team competing in the scavenger hunt, there is a one-line entry in the  finds.txt  file. The form of a line entry is

First_Name  Last_Name  No_Items_Found  List_of_Items_Found

The first and last names refer to the team's leader.  The list contains the names of the items that the team found.  There is no particular order to the list.  Because teams may find 30 or more items, the entry for a team may be quite long.  Below are the first two entries in the  finds.txt  file; the entries have wrapped onto multiple lines because of their length.

Dennis Mitchell  12  beads  bandaid  balloon  green-tic-tac
Wendy's-coupon  shot-glass-with-picture  child's-toothbrush
novelty-hat  windshield-wiper  blue-candle  whistle  nutcracker
Charlie Brown  19  bandaid  clothespin  green-tic-tac
Wendy's-coupon  beads  novelty-hat  blue-candle
lawyer's-business-card  dried-flower  nutcracker  kaleidoscope
3-hole-punch  lens-cap  whistle  child's-toothbrush
orange-flashlight  floppy-disk-holder  pocket-watch  2001-calendar

Your program needs to determine and display the following information.
 

  1. Names of the team leaders for teams who find the hardest to find item.  This is the item that is worth the most points.  The display should show this item's name.

  2.  
  3. The names of the leaders of the first, second, and third place teams and the number of points each of these teams accumulated.  For this part, the answers you should get are:

  4. Leaders and Team Scores for Top 3 Places
    Hilary Forth  515
    Rex Morgan    509
    Mark Trail    489
     

  5. The name of the leader of the team that won the Sticky Fingers Award by finding the most items.  The display should show how many items this team found.

  6.  
  7. The name of the leader of the team that won the Broken Spy-glass Award by accumulating the fewest points.  The display should show how many points the team earned.
In the course of writing the program, you are required to have at least two functions, in addition to main.  One function must be called SearchArray; it must be used to look up each found item and return the point value associated with it.  The other function must be called TopThree; it must be used to determine the three top finishers in the hunt.  That is, TopThree must determine the first, second, and third place finishers.  You may have additional functions in your program; but you must have these two.

Hand in a printout of your well-documented program and the captured output from executing your program.  Also, copy the .cpp file for your program to the hand-in folder on the P: drive.

You can find the finds.txt and huntitems.txt files on either the I: drive in I:\jlwolfe\110 or the P: drive in P:\courses\spring2006\cosc\cosc110\xxx\information where the xxx is your section number (002 or 003).
 

Extra Credit:  You can get extra credit for this project by doing two small additional tasks.

1. Display the number of teams that found the easiest to find item.  The display should show what this item is and how many points it is worth.  You are guaranteed that there is only one item which fits this description.

2.  Display the number of teams that found 30 or more items.