Fall 2006

Clay Shields


front | classes | research | personal | contact

Caterer Cook Counter

Assigned: October 5th
Design Due: October 12th
Program source code due: October 19th

back

Sid runs a wedding catering company named Sid's Itinerant Compact Kitchen. He has a mobile kitchen that can arrive at events, set up 4 tables of 16 seats that are carried within, and then serve a delicious dinner. His menu is simple, as he makes four different types of dishes from beef, chicken, fish, or vegetables for each meal. In order to help him prepare a delicious wedding feast, he asks his guests to provide him with a file that describes who is coming, which menu item they want, and the table number where they are sitting.

To make his life easier, he wants you to write a program that will take one of these files and count up how many of each dish go to each table, and how many total of each dish he will need. The files that he will give you will all have the same format, and will consist of many lines of data each with a table number, a food item, and a guest name. The table numbers will range from 1 to 4, the food items will be one of beef, chicken, fish, or veggie. The guests name will be whatever the guests name is, and can be of any form. An example guest file is show below:

   1 fish Marylyn  Fulton
   1 beef Dr. Janeka  Ling
   1 beef Katherina  Sandys
   1 veggie Clement  Drabble
   2 chicken Reina  Sidower
   2 fish Lyssa A. Newton
   2 veggie Baptist  Greif
   2 chicken Abby  Powell
   2 beef Mackenzie  Schuth
   3 beef Amanda  Stanfield
   3 chicken Orrell  Carr
   3 veggie Leia  Muller
   3 veggie Bert Woodworth-Smith
   3 fish Winnifred  Sachse
   4 beef Pearle  Finck
   4 chicken Steven  Mortland
   4 fish Carine N. Ruhl
   4 chicken Julia  Crom
   4 fish Amice  Tavoularis
   4 veggie Heath  Canham 
   

Your assignment

You are to write a program that will ask for the name of an guest file to read. The program will then calculate the total number of each dish for each table and the total number of each type of dish. Below is the output of a program that does this:
seva% ./dishes
Welcome to the SICK meal maker. This program will calculate the number of meals needed for a particular wedding as specified in the file provided as input. Please enter the name of the guest file to use: guests Table 1: 2 beef 0 chicken 1 fish 1 veggie Table 2: 1 beef 2 chicken 1 fish 1 veggie Table 3: 1 beef 1 chicken 1 fish 2 veggie Table 4: 1 beef 2 chicken 2 fish 1 veggie
You will be able to run the version of the program that does this by logging onto seva and typing ~clay/dishes. I will post an update to this page when I make this available.

UPDATE

You can now run my version of the program on seva by typing:
~clay/dishes
when asked for the filename. You can also copy the guest file to your directory by typing:
cp ~clay/guests ./

Part 1 - Design Document

For the first part you are to submit a design document showing the algorithm you plan to implement.DO NOT SUBMIT A FLOWCHART. I won't grade it. Instead, write it out neatly using a language which is similar to that from Homework 1 and has the following terms:
  1. input
  2. output
  3. calculate
  4. if condition, then statement
  5. if condition, then statement; otherwise, statement
  6. while condition, do statement
  7. start
  8. stop
If you need to group multiple statements together, say in an if or while statement, use the following structure, including indentation:
    begin
       statement
       ...
       statement
    end
For calculate, you may only use the expressions we have covered in class.

A copy of your algorithm is due in class. Be sure to keep a copy for yourself!

Part 2 - Program Source Code

Important: Your output and input should be very similar to that shown in the example program. Please ask for the input in exactly the same order shown and only request the same items shown - do not ask for any other input. This will assist in grading your program.

Include the following header in your source code.

//
// Project 2
// Name: <your name>
// E-mail: <your e-mail address>
// COSC 071
//
// In accordance with the class policies and Georgetown's Honor Code,
// I certify that I have neither given nor received any assistance
// on this project with the exceptions of the lecture notes and those
// items noted below.
//
// Description: <Describe your program>
//

You will submit your source code using the submit program. This is the .cc file. Do not submit the compiled version! I don't speak binary very well.

To submit your program, make sure there is a copy of the source code on your account on seva. You may name your program what you like - let's assume that it is called dishes.cc. To submit your program electronically, use the submit program like we did in Homework 2 and Project 1, but with the command:

./submit -a p2 -f dishes.cc

I will not be enabling the electronic submission until after the design documents are in, so don't try to submit too early.