Project #5
Competition at the Arboretum
(Due 11 April 2008)
Each year, Ms. Peach and Ms. Patterson take their fifth grade classes to the Urbandale Arboretum on a science field trip. Each teacher tells her students to find the common names of as many trees as they can during the free-for-all segment of the trip. Over the years, the teachers have worked out an arrangement with the Arboretum staff so that each exhibited tree has a small card dispenser next to it which produces a small card containing the common and scientific names of the tree when a button is pressed. A timer attached to the dispenser insures that a student cannot get more than one card per tree. The students collect the small cards to get the common names and to show how many trees they have visited. The students are also required to identify which tree, of those they visited, is their favorite; they may choose their favorite using any criteria they want - height, shape, bark, leaves, flowers, whatever.
When the class gets back to the school, each teacher collects the students cards and creates a file containing information in the following form (one student per line in the file).
First-name Last-Name No.-of-trees List-of-common-names Rating Favorite-tree
Here is an abbreviated sample, the first few lines of Ms. Patterson's file.
Jon Arbuckle 7 Green-Spire-Birch Variegated-Aralia
... 9 American-Chestnut
Beetle Bailey 6 Swamp-White-Oak American-Hornbeam
... 8 Giant-Sequoia
Buster Brown 5 Giant-Sequoia Tulip-Tree
Swamp-White-Oak ... 6 Black-Maple
Andy Capp 14 Freeman-Maple
Shellbark-Hickory ... 10 Western-Red-Cedar
Each of these lines have been shortened to display here; the ... replaces several more tree names. In this sample, Jon Arbuckle has visited 7 trees (Green Spire Birch, Variegated Aralia, etc) He rates the field trip as a 9, on a scale of 0 to 10; and his favorite tree was the American Chestnut. As you can see, the names are hyphenated (this is to make it easy for you to treat each one as a single string). There are < 100 different trees and < 40 students per class.
Write a program to do the following with each of the files produced from the field trip.
Average Student rating for field trip: 7.21
Student's Names
Trees Found
Snuffy Smith
18
Linus VanPelt
18
Funky Winkerbean
18
...
Most popular tree: Shagbark-Hickory with 4 votes.
Common Tree Name
Reported
Bigleaf-Maple
10
Japanese-Snowbell
7
American-Hornbeam
7
...
Your program is required to have at least three functions in addition to main. Your program is also required to be structured so that it needs to be executed only once to produce the report for Ms. Patterson's class and to produce the report for Ms. Peach's class; that is, the program needs to do all of its actions twice. You are required to hand in a printout showing both reports.
Hand in a well-documented printout of your program and a printout of the captured output from both reports. 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 wolfep5.cpp
Extra Credit:
Do either or both of the following tasks to gain extra credit. If you do either of these, you need to make a note on the printout telling me that you are doing it.