UMBC CMSC 201
Spring '08

CSEE | 201 | 201 S'08 | lectures | news | help

CMSC 201
Programming Project Five

Meal Planner

Out: Monday 4/28/08
Due: Before 11:59 PM, Sunday 5/11/08

The design document for this project, design5.txt
is due: Before 11:59 PM, Sunday 5/04/08

The Objective

The objective of this assignment is to give you practice with project and function design. It will also give you an opportunity to work with linked lists, reading information from a file, using dynamic memory allocation, guarding header files and dealing with command line arguments.

The Background

An important activity in any household, is the planning and serving of balanced meals to the family. This process begins when you visit the grocery store to purchase items to stock the pantry. Even if you are not currently concerned about how many calories, or grams of fat, or milligrams of sodium you are consuming each day, there will come a time in your life when you will have to be aware of such things, either for yourself or some member of your family.

My local grocery store provides a book called the "Food Guide" for only a few dollars. This book has listed the nutritional data for almost every item they sell. This includes information on pre-made items, mixes and kits, canned or frozen foods, as well as fresh meats, seafood and produce. This book can be used along with your family recipes to construct the nutritional data for each dish you prepare.

Meals can be constructed from these food items that are available in your pantry and totals of the nutritional data can be calculated, so that you'll know how many calories, sodium, etc. each person will consume if they have one helping of each item.

The Task

Design and code a project that will allow you to read in the information from a text file, create linked lists of those items by type (MEAT, STARCH, VEGETABLE, FRUIT, or DESSERT) to represent the pantry, allow the user to build meals from these items (also linked lists) and report the nutritional data for the full meal. The user can create as many as 7 meals, one for each day of the week. I have restricted the food items in the file to be those typically served for dinner.

The Specifics

See the sample output for a suggested format. The contents of the text file is a list of food items and their nutritional information. Each food item has the following form in the file:

The Specifications

Your program may make the following assumptions

SampleOutput

Although your output need not look exactly like the sample output, all information must be present. Your program must also print a short greeting. Don't be concerned if your output scrolls off the top of the screen. It will be very difficult to keep all output on a single screen.

There are two approaches to this problem...

  1. Use the unix script command to capture your output in a file (named typescript) in order to examine it.
    For more information on the script command, see the Unix man pages.
  2. Redirect the output of your program into a file using Unix redirection as discussed in class.

Submitting the Program

You are to use separate compilation for this project, so you will be submitting a minimum of three files, or more as you see fit.
Your C source code file that contains main() MUST be called proj5.c. I would expect that you would also have files called meals.c and meals.h, and possibly util.c and util.h if needed.

To submit your project, type the following at the Unix prompt. Note that the project name starts with uppercase 'P'.

submit cs201 Proj5 proj5.c meals.c meals.h (and possibly other files, separated by spaces)

To verify that your project was submitted, you can execute the following command at the Unix prompt. It will show all files that you submitted in a format similar to the Unix 'ls' command.

submitls cs201 Proj5


CSEE | 201 | 201 S'08 | lectures | news | help

Wednesday, 30-Apr-2008 11:03:30 EDT