Question: Write a C++ program to simulate a vending machine using the switch statement. It is stocked with the following items. A - Hershey Bar Plain,
Write a C++ program to simulate a vending machine using the switch statement. It is stocked with the following items.
A - Hershey Bar Plain, $0.60 B - Hershey with Almonds, $0.65 C - M&Ms, $0.50 D - Trail Mix, $1.00 E - Milky Way, $0.95
Assume the user inputs one dollar. Provide the user with a menu list which must look like the one above. Ask the user for the letter corresponding to the item they want. Let the user know the item was dispensed and how much is in the change dispenser. An example of the user purchasing a bag of M&Ms might look like:
Welcome to the Dewy, Cheatum, and Howe Vending machine. You have input $1, please make a selection by inputting the character preceding the item. C
Your item has been dispensed, please enjoy!
You have 50 cents in the change dispenser.
Would you like to make another purchase, (y/n) ?
Then use a while loop to repeatedly use the program.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
