1

I'm trying to build a table to describe the behaviour of the FSA for a coin change machine described below.

There is a slot that accepts a 50c coin and 2 buttons that a user can press to get a 20c or 10c coin as change. As soon as the 50c coin is inserted the machine locks to prevent another coin from being added. When the user presses the 20c button the machine checks that the remaining value is sufficient then gives the user a 20c coin. If the remaining value isnt sufficient the machine "dies" (for simplicity). The 10c button works similarly.

The events of the machine are insert50c, give20c, give10c.

So, from my understanding this FSA has 6 states lets say 0,10,20,30,40,50. The states are represented by the value of money remaining to be returned. I've drawn a rough state diagram here but am i missing any transitions?

Kimeru
  • 21
  • 1
  • 3

1 Answers1

0

your statechart looks good. In the task it said " a user can press to get a 20c or 10c coin". I am missing this user interactions completely. What is if there is an amount of 10c and the user presses 20c?

So if the machine is only allowed to accept 50c for change and not 20c it's ok. Every coin change, money exchange machine has a Cancel button to break up. What is with this?