In class, we are asked to draw a finite state machine with the following instructions:
Design a finite state machine to model a vending machine that accepts only quarters and gives a container of juice when 75 cents have been deposited, followed by a button being pushed. If a fourth quarter is deposited before the button has been pushed, this quarter is immediately returned. If the button is pushed before three quarters are deposited, nothing will happen. The machine is in state Si (i = 0; 1; 2; 3) when it has been given i quarters towards the next purchase. Inputs to the machine are Q (inserting a quarter) and B (pushing a button). After one request is processed, it is ready for another request.
I'm not entirely sure what I'm doing is even remotely correct. For instance, I'm not sure how to represent the "return" or "dispense" actions, right now, the are represented as states, but I don't know if that is legally correct or not. I also don't know if my return Q4 is correct. There are no inputs on the lines connecting S4 to Return to S3, and I was hoping that that would mean that those happen automatically without input, is this correct?


