//Define constants const int MAX=5; // vending items const int QUARTERS=40; const int DIMEs=50; .... //Prototypes void displayMenu(); int getOption(); double vendOption(int opt, int& chipsOnHand, int &gumOnHand, int &CurlsOnHand); //Main int main() { int opt; int chipsOnHand=MAX, gumOnHand=MAX, CurlsOnHand=MAX; double cost=0, total=0; do { displayMenu(); opt=getOption(); if (opt !=7){ cost =vendOption(opt, chipsOnHand, gumOnHand, CurlsOnHand); total += cost; } } while (opt!=7); cout << "You owe " << total; return 0; } void displayMenu() { // cout the 6 options and 7 for exit } int getOption() { //get the option from the user // while the option is out of range, re-enter // return the validated option } double vendOption(int opt, int &chipsOnHand, int &gumOnHand, int &CurlsOnHand) { double cost; switch (opt){ case 1: if (chipsOnHand == 0){ cout <<"Out of Chips. Try another option"; cost = 0; } else { chipsOnHand--; cost = 1.0; } break; case 2: ... case 3: ... } return cost; }