// Name: Alan Helms // Class: CPT 232 C++ I // Times: MWF 9:00 - 9:50 // Semester: Spring 1-27-2003 // Project Name: BurgerJoint_vf3x.cpp // Program Purpose: To create a burger stand program, which has burgers for // $2, hotdogs for $1, and drinks for $1. Program needs to // get user to input the # of each item, calculate a total, // and allow the user to pay and recieve change. Change will // be presented as a total figure; then presented in // denominations. // // ****NOTE: CREATED WITH BORLAND'S C++ v5.02 EDITIOR**** // ****NOTE: MODIFIED FOR MICORSOFT VISUAL STUDIO C++**** #include using std::cout; using std::cin; using std::endl; int main(){ char yes_NO; // determines if order is needed. int bj_Burger, mj_Hotdog, jb_Drink; //input vars. for items. int collectPay, changeBack; // collect payment, return change, testing. int total; // the sum of the all the items. // outputs, "EAT AT JOE'S", the title of the program to screen. cout << endl; cout <<" ***** * ***** \n"; cout <<" * * * * \n"; cout <<" *** ***** * \n"; cout <<" * * * * \n"; cout <<" ***** * * * \n"; cout <<"\n"; // line break cout <<" * ***** \n"; cout <<" * * * \n"; cout <<" * * * \n"; cout <<" ***** * \n"; cout <<" * * * \n"; cout <<" * * * \n"; cout <<"\n"; // line break cout <<" ***** ***** ***** ** **** \n"; cout <<" * * * * * * \n"; cout <<" * * * **** **** \n"; cout <<" * * * * * * \n"; cout <<" ***** ***** ***** **** \n"; cout <<"\n"; // line break // end of title // Prompt user with intro to program and intructions cout <<"Welcome to \"EAT AT JOE's\" resturant. We have the \"BIG\n"; cout <<"JOE\" BURGER for $2, the \"MIGHTY JOE\" HOTDOG for $1, and\n"; cout <<"\"JOE'S BOTTOMLESS\" BEVERAGES for $1.\n"; // prompt: ask user if wishes to make a purchase cout << "Would you like to place an order?(y == yes, n == no)\n"; cin >> yes_NO; // is a char var. data type. // detemines wheather var "yes_NO" is yes or no if ((yes_NO == 'y') || (yes_NO == 'Y')){ // Prompt user to enter the number of each item cout <<"Please enter the quanity beside each item"; cout << " and press ." << endl; // user enter the data here cout <<" \"BIG JOE\" BURGER\r"; // returns to beginning of line cin >> bj_Burger; // the following three conditions if (bj_Burger < 0){ cout << "You enter an invalid integer. Please try again.\n"; cout <<" \"BIG JOE\" BURGER\r"; cin >> bj_Burger; } cout <<" \"MIGHTY JOE\" HOTDOG\r"; cin >> mj_Hotdog; if (mj_Hotdog < 0 ){ cout << "You enter an invalid integer. Please try again.\n"; cout <<" \"MIGHTY JOE\" HOTDOG\r"; cin >> mj_Hotdog; } cout <<" \"JOE'S BOTTOMLESS\" BEVERAGES\r"; cin >> jb_Drink; if (jb_Drink < 0 ){ cout << "You enter an invalid integer. Please try again.\n"; cout <<" \"JOE'S BOTTOMLESS\" BEVERAGES\r"; cin >> jb_Drink; } // add the value of items and assigns to var. total total = (bj_Burger * 2) + mj_Hotdog + jb_Drink; cout << "\nYour total is $" << total << "." << endl; // prompts user to enter the amount of money needed to // purchase the item(s). cout << "Enter the amount of tender collected.\n"; cin >> collectPay; // that value is stored here // if payment not equal to price of items // condition determine how much change to give back. if (collectPay >= total){ // makes the change changeBack = collectPay - total; // outputs var changeBack to screen cout << "\nYour change is ($"<