Question: Using C++ create the following code for a vending machine: The vending machine will have 4 inputs and will dispense at amounts of 30, 35,

Using C++ create the following code for a vending machine:

The vending machine will have 4 inputs and will dispense at amounts of 30, 35, 40, 45 and 50 cents.

q for quarters which = 25

d for dimes which = 10

n for nickels which = 5

d for dispense

the code will have a running state of the user input.

the vending machine can also not accept a value lower than the previous amount, so if the user inputs a quarter they can not input a nickel or a dime again.

once the amount reaches 30, 35, 40, 45 or 50 cents the user can put in the state d to dispense the soda.

Using C++ create the following code for a vending machine: The vending

Welcome to the Candy Machine! Running, state is 0 Input: d Running, state is 10 Input: q Running, state is 35 Input: q Invalid input Running, state is 35 Input: n Invalid input Running, state is 35 Input: s Dispensing Soda Running, state is 0 Input

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!