Reference no: EM132196870
Write a C++ program for a Vending machine that gives the exact change for the customer.
Create a 3d Array for each 5 products, in the Array store (price, quantity, and product Name).
The program must ask the user to input the amount of money, (money has to be either: 20$, 10$, 5$ or 1$ and must have a while loop to check if the amount entered is correct, and if not prompt user 3 times or display goodbye msg and exit program.
After that user will be able to choose from list of products and after choosing, a method will check if quantity is not equal to 0, and if it's not will display price and return exact change and minus 1 from quantity, if quantity is 0 then user is prompter to choose another product.
Sample output:
"Welcome to our Vending Machine"
"Please enter amount of money: "
User enters
50>>"please enter amount between $20 and $1"
$10>>
"Please chose from product list: "
1 Pepsi $1.75 20ct
2 Coke $1.45 9 ct
3 7up $2.20 ct
4 Dr. Pepper 79c 3 ct
5 Water $1.00 15 ct
6 Mt. Dew $1.32 0ct
User chooses
4>>" Thank you your change is:1x5 and dollar bill 4x 1 dollar bill and 2xDimes and 1x1 Penny.
6>>"Product Unavailable Please choose a different product".