Reputation: 67
i am trying to develop an UML state machine diagram for the following problem:
a vending machine has 3 buttons: R for 'return money, A & B for drink selections. when the vending machine receives amount x of money the user can choose between the drinks. pressing R returns the money without serving a drink.
if a button is pressed before any money is inserted - the machine produces an alarm signal. in case A or B is pressed and >= x money is inserted - the drink will be served.
when serving is done, an alarm sound notifies the user. the change money gets returned. after taking out the drink, the machine goes into the end-state.
my issue is that i am working with parallel 'processes' and i believe that there must be a simple configuration for this scenario. can somebody provide/guide me with the right ideas to solve this in an elegant way?
edit: after using the suggestion of @Chris Reynolds i came up with this:
Upvotes: 2
Views: 2918
Reputation: 36305
Actually there is no parallel process in this state machine*:
The state Return money
is reached by pressing the R
button during Collect money
and while waiting for A
and B
. It sounds an alarm if money is present. You might add behavior to the transition from Collect money
if there's no credit for a different alarm, or just a new transition to self.
*: Assuming that further coin acceptance is blocked once enough money is inserted.
Upvotes: 2
Reputation: 5503
So the state machine is profoundly different if all products are the same price. It can be captured in this table:
Upvotes: 2