Question
Use C+ to write a program that simulates a soda vending machine. In your program include a Soda struct that will hold all the basic
Use C+ to write a program that simulates a soda vending machine.
In your program include a Soda struct that will hold all the basic information about a soda brand.
This information includes brandname, sodaname, ingredients list, and price. The program should:
ask the user if they would like to see the information about all of the products your vending machine has:
-- if "Yes" print all the information about all of the sodas you have in your vending machine. Remember you need at least one in your vending machine
-- if "No" it should skip to the choice menu.
ask a user if they would like to buy a soda:
-- if the user says "Yes", the program should show them the choices in the machine and tell them to choose a number:
-- Next have the user enter their Bison ID #. (This assumes the user has money on their card) -- Based on the User's choice, the program should say:
-- "Your Bison account will be automatically debited " price " for the" sodaname.
-- "Now dispensing...Enjoy!"
-- if the user says "No" the program should do nothing and end.
your program should keep track of the inventory in the machine. For simplicity start out with two sodas in your machine.
-- HINT: You may need to use a loop to go through the above process over and over until your machine is empty.
-- HINT: Remember arrays and vectors can hold structs
-- once empty the program should print out "This machine is empty!"
EXAMPLE:
Would you like to see information on the sodas for purchase? Yes
Coke Zero, $0.75, includes sugar, water, coloring
Pepsi Dr. Pepper, includes splenda, water, coloring
Would you like to buy one? Yes
Chose from:
Dr. Pepper, 0.75
Coke Zero, 0.75
Your choice, 0 for none: 1
Enter your bison number: 05555555
Your Bison account will be automatically charged 0.75 for the Dr. Pepper!
"Now dispensing...Enjoy!"
Would you like to see information on the sodas for purchase? No
Chose from:
Coke Zero, $0.75, includes sugar, water, coloring
Your choice 0 for none: 1
Enter your bison number: 05555555
Your Bison account will be automatically charged 0.75 for the Coke Zero!
Now dispensing...Enjoy!
The machine is empty!
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started