Tuto 7
Tuto 7
We want to write an algorithm in which a user can take the following actions: (a) define parameter 1 (b)
define parameter 2 (c) calculate result. The user defines parameter when respective requests (req1 and
req2) comes in. When req3 comes in, user takes action of calculating result only if both the parameters
are defined. When req3 arrives without defining both parameters, an error message is issued. Receiving
request for defining a parameter again before result calculation defines that parameter again with the
new one. After result calculation, the algorithm should repeat.
Construct a state diagram (or FSM) defining states, a list of tests and actions.
Ans:
The starting state in the FSM is “None Defined” which means no parameter is defined when system is
in this state. Then, depending upon type of request, FSM grows.