Project #4
(Trip to the Botanical Garden)
(due 2 Nov 05 )
Miss Peach took her fifth grade class to the botanical garden for a field trip. Each student is assigned the task of writing down the names of 10 flowers that are their favorites (or at least ones that they like or find interesting) at the garden. To keep these lists reasonable, Miss Peach asked the students to write down only the common family names for their favorites. (Writing the scientific names would be very prone to error.) The only drawback of this approach is that some students wrote down the same family name more than once, because they found several different species within the family that they wanted to include each among their favorites. Each flower family has many different species.
For the most part, the students did as Miss Peach asked. However, some students did not find 10 favorites; they found fewer. Also, some students did not write down the whole family name. They wrote only the first few letters - but at least those letters were enough to distinguish which family they meant. Miss Peach collected all of the student information and had it put into a file named favorites.txt; now, she needs to extract information that she will use in a report to the school superintendent about the trip. You are to write a program to extract the information the Miss Peach needs.
favorites.txt contains information in the following form.
On the first line:
Miss Peach Family_names_of_Miss_Peach's_Three_Favorite_Flowers
This is the teacher's name and her three favorite flower families.
On each subsequent line:
student_name trip_rating no_of_favorites favorite_family_names
The student's name includes a first name and a last name, separated by a space. The trip rating is an integer from 1 to 10 which indicates the student's rating for this trip. The number of favorites is an integer from 0 to 10 which indicates how many favorites the student found. This is followed by the specified number of favorite flower family names. There is at least one space between each two elements on the line. All family names are a single word with no embedded spaces. Some family names are present only in prefix form; that is, only the beginning letters are present. Following is an example of one student line from the file:
Broom Hilda 5 6 Mallow Honeysuckle Orchid Lily Pickerelweed Primrose
You can get a copy of favorites.txt from the I:\ drive (I:\jlwolfe\110\favorites.txt) from the P:\ drive (P:\courses\fall05\cosc\cosc110\xxx\information\favorites.txt where xxx is your section number) or from WebCT (entry just after Project #4 in the Outline).
Your program must read the favorites.txtfile,
calculate and display the following information on the screen with appropriate
identification.
Hand in a printout of your well documented
program made with Visual Studio. Hand in a printout of the program's
output to the screen, captured in the usual way. Copy your .cpp file
(named after yourself) to the handin folder on the P: drive.