Project #4
(Cookie Competition)
(Due 27 October 2006)
The Talus Rock Council of the Girl Scouts of America has created a little competition for the Girl Scout troops in their region. This year two awards were set up in association with the annual cookie sales. In this inaugural competition, the council is referring to the awards as the "Cookie Sales Award" to go to the troop whose average sales among the girls in that troop are the highest for all troops and the "Most Sales Award" to go to the troop which sells the most boxes of cookies. For future years, the awards will be renamed; the Cookie Sales Award will be named after the mascot of the winning troop from this first competition; and the Most Sales Award will be named after the mascot of the winning troop from this first competition. So, there is a lot on the line. Each troop has identified a mascot (generally, the name of a pet animal of one of the girls) and submitted the name which will represent their troop.
The year's cookie sales have been tallied for all girls in all troops and stored in a file named cookies.txt You can find a copy of this file on the I:\ drive. It is at I:\jlwolfe\110\cookies.txt The information is stored in the file in the following arrangement - each line of the file contains the info about one troop:
Mascot Troop# MemberCount Sales-for-each-Member
for example, here are the first three lines from the file
Pluto
4 16 22 19 11 20 8 6 5 9 17 21
10 11 12 15 11 22
Hobbes 8
19 16 21 23 18 24 11 24 21 8 13 21 14 17 12 11 18 15 22
9
Dilbert 9
14 14 9 6 20 12 7 8 23 16 7 17 12 19
12
Pluto is the mascot's name for Troop #4; this troop has 16 members, the other numbers are how many boxes of cookies each of the 16 members has sold. Hobbes is the mascot's name for Troop#8; it has 19 members, etc.
The Talus Rock Council has decided that it wants a report on the cookie sales, in addition to identifying the winners of the two awards. The report must show the following information for each troop: Troop number, Mascot name, Number of girls in the troop, Maximum number of boxes any girl in the troop sold, Minimum number of boxes that any girl sold, Total sales for the entire troop, and the Average sales for the girls in the troop. Here are the first few lines of what such a report might look like, showing troops 4 through 12.
Troop Mascot Girls
Max-Sold Min-Sold Total-Sold Average
4 Pluto
16 22
5 219
13.69
8 Hobbes
19 24
8 318
16.74
9 Dilbert
14 23
6 182
13.00
10 Sandy
11 22
5 132
12.00
12 Nancy
8 23
6 99
12.38
You are to write a program that produces a report like that above for all troops in the Council area, i.e., all troops listed in the cookies.txt file. After the report, the program should show the troop number, mascot name, and winning statistic for each of the awards. Finally, the report should show the total number of boxes of cookies sold by all girl scouts from all of the troops.
Hand in a well commented listing of your
program with a printout of the output of the report (table and additional
results). You can capture the output as you did for previous programs.
Make sure the source file (the .cpp file) is named after yourself
and copy it to the handin folder for this course on the P:\ drive.