CPSC 231: Assignment 2 (Due Thursday, July 11)

Weighting = 2%

For this assignment you are to document the algorithm describe below by using either the pseudo-code notation learned in lecture or flowcharts.  It is up to you which one that you use.  In either case while assignment submissions must be legible to the marker they need not be completed on the computer.  Hand drawn and hand written submissions are okay (and actually recommended over the electronic form).

Jim Tam Ace Gourmet™  is dining at the Gorge-it Medieval style buffet.  Jim will go up to the buffet table until he is full.  However he will go up to the table at least once.  At the end of the meal he will then go to the cashier to pay the bill.  The buffet provides the following choices:

    1) Entree dishes (meat, fish, poultry, seafood and various soy-based substitutes)

    2) Salad bar (a wide selection of fruits and vegetables)

    3) Desert tray (enough confectionaries to satisfy any sweet tooth)

Each time that Jim goes up to the buffet table, he will help himself to one serving of the entree dishes.  He will only help himself to a serving from the salad bar on his first trip to the buffet and his last trip.  Jim will only go to the desert table on his last trip to the buffet table.

Being a diet-conscious fellow Jim wants to track the total calorie count for the meal.  Each time that he visits the buffet table he will note in his calorie counter the following values:

    1) Entree dishes: Assume 500 calories for each time that Jim grabs a serving

    2) Salad bar: Assume 50 calories for each time that Jim grabs a serving

    3) Desert tray: Assume 1000 calories for each time that Jim grabs a serving

Learning objective:

To be able to solve a problem by specifying the algorithm independent of the programming language that will eventually be employed.  Students will be exposed to two different techniques: writing pseudo-code and drawing flowcharts.  Students are free to choose the technique that suits them based upon personal preferences.