// Programmer: Dylan McDonald // Class & Section: CS 54, Section // Date: January 30, 2007 // Purpose: To gain weight at Clayton's Cafeteria #include using namespace std; int main() { /* delcare constants used in all parts */ const int DONUTCAL = 450, ICECAL = 350, PICAL = 500; const int DONUTFAT = 18, ICEFAT = 20, PIFAT = 15; const double DONUTPRICE = 1.5, ICEPRICE = 2.2, PIPRICE = 3.141592; int choice; /* part I - display menu */ cout << "Welcome to Clayton's Cafeteria!" << endl; cout << "1) Jelly Donuts $1.50" << endl; cout << "2) Ice Cream $2.20" << endl; cout << "3) Cherry Pie $3.141592" << endl << endl; /* part II - ask for what they want and validate it */ /* part I is the same without the do...while loop */ do { cout << "And what is your pleasure today? "; cin >> choice; } while (choice != 1 && choice != 2 && choice != 3); /* part I - take the choice and print out the information */ /* ...for donuts */ if (choice == 1) { cout << "Your order costs $" << DONUTPRICE << ", has " << DONUTCAL << " calories, and " << DONUTFAT << " grams of fat." << endl; } /* ...for ice cream */ else if (choice == 2) { cout << "Your order costs $" << ICEPRICE << ", has " << ICECAL << " calories, and " << ICEFAT << " grams of fat." << endl; } /* ...for pie */ else if (choice == 3) { cout << "Your order costs $" << PIPRICE << ", has " << PICAL << " calories, and " << PIFAT << " grams of fat." << endl; } /* ...for items with DNE problems */ else { cout << "There exists no such item!" << endl; } return 0; }