ESc 014
Assignment 1 -- Cookie, Cookie
Due: Tuesday, April 9, 2002
Objectives
- Review the major concepts you've already learned from ESc 013
- Practice the switch statement
Your Mission
Your task is to write a program that can keep track of the
number of boxes of girl scout cookies sold by a local troup.
Your program will read in a file containing information about
how many boxes of cookies each girl scout sold. After that,
your program will display a menu of different statistics
that the user can see. This menu should let the user do
any of the following:
- see the full list of girl scouts and the number of cookies
each one sold
- see which girl scout sold the most boxes
- see if any girl scout sold the majority of the cookies
(more than half the total number of boxes) and, if so, show
the name of that girl scout. If no majority exists, then that
should be told to the user.
- quit from your program
The user should be able to pick an option from this menu, see the
results, and then be returned to the menu to pick another option.
Sample Output
Output from your program may look like the following:
Please make a selection:
1. Show stats for all girl scouts
2. Show girl scout who sold most boxes
3. Show girl scout with majority (if any)
4. Quit
Make your selection: 1
Andrea: 7
Barb: 48
Candice: 11
Deidra: 10
Eileen: 5
Please make a selection:
1. Show stats for all girl scouts
2. Show girl scout who sold most boxes
3. Show girl scout with majority (if any)
4. Quit
Make your selection: 3
Barb sold the majority.
Please make a selection:
1. Show stats for all girl scouts
2. Show girl scout who sold most boxes
3. Show girl scout with majority (if any)
4. Quit
Make your selection: 4
Thanks for using the Girl Scout Manager
Press any key to continue
Your output doesn't have to look exactly like the above,
but it gives you a good idea of how your program should work.
Feel free to give more detail than I have above. For example,
when the user asks for the majority, you may want to print
the number of boxes the person with the majority sold along
with the total number of boxes sold between all the scouts.
The Details
- Data file. The input file, which you can download from
the Course Materials section of
BlackBoard, consists of names
of girl scouts, one name on each line. For this assignment, you may
assume that we are dealing with a particular scout troup
containing five scouts: Andrea,
Barb, Candice, Deidra, and Eileen. Each time a scout's name appears
in the input file, that scout has sold 1 more box of cookies.
- Structures. You must use at least one array in your
program (feel free to use more). This array will contain the total
number of boxes sold by each scout. Hence, each place in the array
will contain one particular girl scout's total.
- Functions. You need at least five functions in your
program, though feel free to use more. The five required ones are:
- a function to read in the input file and calculate the number
of boxes sold for each scout. As mentioned, you may assume that the
five names listed above will be the only ones appearing in this file.
Extra Credit alert: it would be cooler if this function worked
for any input file, regardless of how many scouts there were or what
their names were. You may assume that a troup contains no more than 12
girl scouts.
- a function to display the main menu to the user and
process the user's choices by calling the appropriate function below.
You are required to use a switch statement when processing menu
choices.
- a function to find the scout who sold the most cookies. This
should be called by the menu function.
- a function to find the scout who sold the majority of the boxes
or determines that no majority exists. This function should be called
by the menu function.
- a function to print each scout's name along with the total number
of boxes she sold. This function should be called by the menu function.
Grading
The same standards you had for programs in ESc 013 will be used
throughout this course. You should check out the
assignment standards on our ESc 014 web
page to see complete details.
This assignment is worth 50 points, divided as follows:
- 25 pts for your output. Your program must be both correct and
complete.
- 25 pts for your design. Good design includes good documentation
(opening comment block, good formatting, meaningful variable names,
etc. worth 10 pts), good C++ language usage (worth 10 pts) and good
testing of your code (worth 5 pts.) As in ESc 013, you should append
your test case results as comments at the end of your source code.
Remember to turn in both a paper and an electronic copy of your
project on BlackBoard, just like
you do for labs. Name your file with your FULL NAME along with the
assignment number (e.g. chrisfernandes_hw1.cpp)
Having trouble?
Don't wait until the last minute! Come see me and get
your $80 worth.
Administrative statement
Programming assignments
are individual
projects. I encourage you to talk
to others about the general nature
of the project and ideas about how to pursue it. However, the
technical work, the writing, and the inspiration behind these
must be substantially your own. If any person besides
you contributes in any way to the project,
you must credit their work on your homework.
Similarly, if you include
information that you have gleaned from other published sources, you
must cite them as references.
Looking at, and/or copying, other people's programs or written work is
inappropriate, and will be considered cheating.
Return to Assignment Index