Document Sample
lab3 Powered By Docstoc
					                                          Lab 3
Create a directory named lab3 in your cs54 directory and make sure you are in that
directory. (pwd should give nethome/users/<your home directory>/cs54/lab3).

Welcome to Chartwell’s Cafeteria. Today we are featuring:

      Cheeseburger $1.50
      Pepperoni Pizza $2.42
      Apple Pie $3.14

Because of previous trouble with the Federal Cafeteria Commission (FCC), we have been
required to post information about the caloric and fat content of our foods:

                Food                            Calories         Fat (g)
                Cheeseburger                    250              15
                Pepperoni Pizza (1 slice)       295              14
                Apple Pie                       320              12

Programming Assignment
Write a program that will ask which food the student wants to order from the menu, and
report how much is costs and how many calories and fat it has. Add that food to the
students order and make a loop that will redisplay the menu options until the student is
done ordering. Keep track of the total cost, calories, and fat in the order, and display that
information when the student is done ordering. You must check to make sure the student
only enters valid menu choices, and continue to ask for a menu choice until a valid one is

Optional (2 extra points):
Keep track of which foods and how many of each food were ordered. For each food,
calculate the weight the student can expect to gain from x number of that food using the
following formula for each food item:

       w = 4.2c + 75f          c = calories, f = fat

Then multiply the result (w) by .0022046 to convert this to pounds. When the student is
done ordering, display the weight in pounds they can expect to gain from x number of
each food in their order, in addition to the information for the main assignment.

      When you are finished, print both the .cpp file and an example of your program’s

       Command for printing .cpp file: lp –d mcs207 lab3.cpp
       Command for printing output:

Shared By: