Hello, OnlineGDB Q&A section lets you put your programming query to fellow community users. Asking a solution for whole assignment is strictly not allowed. You may ask for help where you are stuck. Try to add as much information as possible so that fellow users can know about your problem statement easily.

UML State machine example - is it correct logic?

0 votes
asked Aug 29, 2018 by anonymous


Hi guys, I'm trying to draw UML state machine, but seems to me there are 100 ways the task can be done and understood, I would really appreciate if you can check this and warn me about errors if I made some?

Task: - the vending machine receives 1,2 and 5 $, the price of drink is 2 $
- it dispenses the drink if enough money is entered and refunds change
- machine has power on and power off)

If I understand the principle, on the arrows there should be written:

trigger event
[condition if it exists] /
action


I marked each state and transitions the numbers (STATES = s1,2 ..., TRANSITIONS = p1,2 ...)
to make it easier to answer without drawing
(eg "p1 is wrong, there should be written this" etc)

I should lhave this task solved in 24 hrs. so I would be very grateful for your feedback. Thanks in advance!

PS
1.) Does it eventually return to IDLE which seems to me more logical,
or it must go to the final state (rounded black point) as power off?
Or can there be two final states, so the S5 goes to another final state?

2.)  should it be after P3 or P4 maybe two branches?
i.e. a new branch where the exact price amount is inserted (so there is no need for refund )
- if so, where to put it?

Your answer

Your name to display (optional):
Privacy: Your email address will only be used for sending these notifications.
Anti-spam verification:
To avoid this verification in future, please log in or register.
Welcome to OnlineGDB Q&A, where you can ask questions related to programming and OnlineGDB IDE and and receive answers from other members of the community.
...