You are on page 1of 2

Vending machine:

Vending machine is a machine that dispenses small articles such as food and drinks when a coin or token
is inserted. For example, if it’s a tea vending machine it will give tea to the customer in this scenario cold
drink vending machine is being considered

Example Scenario:
States: q0, q1, q2, q3, q4, q5
Input: 5, 10 and 20 rupees
Output: cold drink and change of money
Price for each cold drink:20 Rupees
In this example 6 states are used q0, q1, q2, q3, q4, q5, q6. Inputs given to this machine are 5 ,10 and 20
rupees. Customer can give 5 10 and 20 rupees and get cold drink as well as remaining change from the
machine. For going from states q0 to state q1 transition is 5,0 which means by accepting 5 rupees it goes
to other states and return 0 rupees. Similarly reading the next input it will continue jumping toward next
states and as soon as transition reached the accepting state q4 it will give the cold drink and return
remaining amount to the customer remaining amount will go to q5 and all user remaining amount will
be given to them

DFA:

You might also like