Coke Machine

The following applet illustrates a simple finite state machine. The inputs are nickels (N), dimes (D), and quarters (Q). The cokes cost 50 cents. After you have deposited 50 cents or more, the machine will provide your coke and your change.



The source.