// John Doe // function demo // day of week?? #include #include using namespace std; // ************** function declaration statements ****************** void displayMenu(); void displayReceipt(double amount); // ******************* constant declaration statements ******* const double BOOK_PRICE = 9.00; // price per book int main() { // *************** variable declaration statements ******* int numBooks = 0; // # of books for this order int totalNumBooks = 0; // total # of books ordered by customer double bookSubtotal = 0.0; // subtotal cost of books bool userWantsToExit = false; // flag variable to exit while loop int menuChoice = 0; // customer's menu choice while (!userWantsToExit) { displayMenu(); cout << "Enter your choice: "; cin >> menuChoice; if (menuChoice == 1) { cout << "Enter number of books: "; cin >> numBooks; if (numBooks >= 0 && numBooks <= 10) { totalNumBooks += numBooks; } else { cout << "Invalid input." << endl; } } else if (menuChoice == 2) { // movie inputs & calculations here } else if (menuChoice == 3) { // peanuts inputs & calculations here } else if (menuChoice == 4) { userWantsToExit = true; } else { cout << "Invalid input." << endl; } bookSubtotal = totalNumBooks * BOOK_PRICE; } // *************** output display ************************ displayReceipt(bookSubtotal); system("pause"); return 0; }// end of main //////////////////// FUNCTIONS //////////////////////////////// void displayMenu() { cout << "1 Books" << endl; cout << "2 Movies" << endl; cout << "3 Peanuts" << endl; cout << "4 Checkout" << endl; }// end of displayMenu ////////////////////////////////////////////////////////////// void displayReceipt(double amount) { cout << endl << endl << endl; cout << "******************************************" << endl; cout << "*** THANK YOU FOR SHOPPING AT ACME ***" << endl; cout << "******************************************" << endl; cout << "Total: $" << amount << endl; cout << endl << endl << endl; }// end of displayReceipt