Sei sulla pagina 1di 4

CSCI1300

- Introduction to Computing
Instructor: Hoenigman/Lewis
Final Project
Due Friday, Dec 11 by 8am.

Working with real data
In this assignment, you have the opportunity apply what youve learned this
semester about programming to an actual problem and actual data. There is a local
non-profit called Boulder Food Rescue (BFR) that picks up produce from grocery
stores and leftover food from restaurants and delivers it to shelters, food pantries,
and other places that feed homeless and at-risk individuals in Boulder. BFR was
founded in 2011 by a group of industrious CU students when they realized that
grocery stores were throwing away significant amounts of fresh produce that could
be used to feed hungry people in the community. Oh yeah, and they use bike trailers
to transport the food.

BFR has graciously provided us with all of their donation data for three years - 2012,
2013, and 2014. There are two files on Moodle. The file called donationData.txt
includes a record of every pickup that a BFR volunteer did, including the store that
donated, the recipient, the volunteer, the donation amount in lbs, the type of food,
and the mode of transportation - bike, car, foot. There is another file called
orgData.txt that lists the name and location for all of the donors and recipients in
donationData.txt. In donationData.txt, donors and recipients are listed by ID, and
you can find the corresponding ID in orgData.txt to get more information about the
organization. This data is also available as a .csv file on Moodle if you prefer that
format over the .txt.

Working on a real problem is fun, and also challenging. The data youre viewing is
the actual data entered by BFR volunteers over three years. The process of
analyzing the data to extract useful information is exactly what you might do if you
were helping BFR develop software or make business decisions using donation
history. The fact that its real data also means that there might be real problems with
it. Its possible that you will find funny characters in the file that crash your program
or formatting different than what your code expects. Ive tried to clean up the data
before giving it to you, but its highly unlikely that its completely clean.

What your program needs to do

In this project, your program needs to extract interesting information from the data
and display it for the user. Some ideas for interesting information include:
Average donations per month in lbs and frequency
Distance between donors and recipients
Total lbs and number of donations per donor
Number of pickups by bicycle in July and February
Number of pickups by individual volunteers
and the list goes on.


Start with a description of what your program does
There is no COG for this assignment, the TAs will be grading everyones project by
hand. Your TA needs to know what your program does when they run it. The first
thing your program needs to do is print a welcome message to the user that
concisely explains program functionality. For example, your program might print
something like:

Welcome. This program calculates the average donations for
three stores for the years 2012, 2013, and 2014.
Select a store from the lists of stores below.

1. Alfalfas
2. C4C
3. Sprouts Market: Arapahoe

Get user input from at least one menu
There should be a menu in your introduction message that asks for input from the
user. You are welcome to have additional menus if you need additional input from
the user. For example, after displaying the menu of stores and getting the user to
select a menu item, you could display an additional menu that asks for a year, such
as:

Select a year:
1. 2012
2. 2013
3. 2014

Present results and ask for another query
Using the input from the user, display the results in a neatly formatted message,
such as:

The average donation in 2014 for Sprouts Market: Arapahoe
was 200 lbs.

After displaying the message, your program needs to ask the user if they would like
to perform any more calculations. If the user says Yes, you should display the first
menu again. If the user says No, you should display an exit message and exit the
program. The details of the exit message are described below in the section: A Final
Message.

Implementation details

Store data from the files in an object


Your program needs to have at least one class. A technical requirement of this
project is that you create a class to support the functionality of the program. I

recommend a Store class, similar to the AppleFarmer class on the last assignment,
where you have an array of donation data or days and you can then use these arrays
to do your calculations. However, you might instead want a Recipient class to store
donations received by a particular recipient, or a Volunteer class to store pickup
information for individual volunteers.

The first thing your program needs to do, even before displaying the welcome
message, is input the data from the txt files. Data should be read in from the files and
stored in the appropriate variable in your class to support what your program does.
You should structure your program to read in all data only one time.

Other details:
1. All variables in your class need to be private and accessed through public
methods. For example, if one of the class variables is the name of the store,
then you will need a getName() method if you want to print the name of the
store in main().

2. Your need at least three objects. For example, if you create a class Store, then
you need at least three instances of Store in your program. If the Store
constructor takes the name of the store as an argument, then you could
create three objects using:

Store sprouts(Sprouts);
Store C4C(C4C);
Store alfalfas(Alfalfas);

3. You are welcome to generate new data files to support your programs
functionality. For example, you may want to generate a new file that pulls out
the data you are interested in and stores it in a separate file. This should be
done in a separate program, and definitely not by hand, and its not a
requirement.

4. If you store data in an array, you can create an array that is larger than you
need and leave some of it unused. Look at the arrays in the AppleFarmer class
for an example of what you might do for this assignment. You will need to
keep track of how much of the array is used. The technique for doing this is
the same as using the currentDay variable in AppleFarmer.

5. The easiest way to read the .txt files is to use getline() for each line in the file
and then use stringstream to parse the line. There are examples of how to do
both of these things in the Lecture42 notes on Moodle.

6. When you submit your program, include all data files you used in your
project directory.


A Final Message
After the user selects No, and you exit your loop, you need to print another message
to the user. In this message, briefly explain the easiest, hardest, and most and least
enjoyable portions of this project. Then, exit the program.

Submitting your code
Zip your project directory, including all files in your program and the data files you
used, and submit is to the Final Project link on Moodle. Your zip file should be called
<LastName>_Final_Project.zip.

Potrebbero piacerti anche