100% found this document useful (1 vote)
70 views1 page

Tuto 7

The document describes an algorithm that allows a user to (a) define parameter 1, (b) define parameter 2, and (c) calculate a result. It takes user input via three requests - req1 and req2 allow defining each parameter, while req3 triggers result calculation if both parameters are defined. Otherwise, an error message is shown. Defining a parameter a second time before calculation overrides the previous value. The algorithm then repeats. It asks the reader to construct a state diagram (finite state machine) defining the states, tests, and actions for this process.

Uploaded by

rosestrikes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
70 views1 page

Tuto 7

The document describes an algorithm that allows a user to (a) define parameter 1, (b) define parameter 2, and (c) calculate a result. It takes user input via three requests - req1 and req2 allow defining each parameter, while req3 triggers result calculation if both parameters are defined. Otherwise, an error message is shown. Defining a parameter a second time before calculation overrides the previous value. The algorithm then repeats. It asks the reader to construct a state diagram (finite state machine) defining the states, tests, and actions for this process.

Uploaded by

rosestrikes
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Tutorial 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.

You might also like