Question: Write a C++ program which will model accepting payment and giving change for a snack vending machine. The machine will contain the following items, shown

 Write a C++ program which will model accepting payment and giving
change for a snack vending machine. The machine will contain the following
items, shown with the label used to select the item, and its
price: Label Item Price tato Chips 1.25 S Snickers Bar 1.35 0.95

Write a C++ program which will model accepting payment and giving change for a snack vending machine. The machine will contain the following items, shown with the label used to select the item, and its price: Label Item Price tato Chips 1.25 S Snickers Bar 1.35 0.95 1.50 $1.75 1.40 T Pop Tart C Cookies B Brownies uts This assignment does have an extra credit option. Please see the Extra Credit section below Requirements: Name the source file for your program program4.cpp of type int) There must be three functions with the following prototypes (Choose a naming scheme that Throughout the program, all amounts of money must be stored internally as cents (in variables suits you, but use these names) int menu (void) int acceptMoney (int price); int computeChange (int totalPaid, int totalPrice); These three functions must behave as follows: menu: must display the list of snack items and prompt the user for their choice. If the user makes a valid selection, the function must return the price of that selection otherwise the user must be re-prompted for a choice until a valid choice from the menu is obtained acceptMoney): must give the user a choice of coins to insert, and add up the total amount inserted by the user, in a loop until this total amount is equal to or greater than the function's parameter price (which is the cost of the user's choice of snack). Once this loop is complete, the function must return the total amount of money inserted by the user

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!