Create and test a method that simulates a general finite automaton. Your program should enable the computer
Fantastic news! We've Found the answer you've been seeking!
Question:
Create and test a method that simulates a general finite automaton. Your program should enable the computer to simulate any given finite automaton and then to simulate, for any given word, step-by-step, how this automaton decides whether this word is accepted by the automaton.
The input to this method should include the full description of the corresponding finite automaton:
- the number N of states; these states are q0, ..., qN − 1; we assume that q0 is the start state; for simplicity, we describe the states by the corresponding integers 0, ..., N;
- the number M of symbols; these symbols are s0, ... sM − 1; for simplicity, we describe the symbols by the corresponding integers 0, ..., M;
- an integer array state[n][m] whose elements describe to what state the finite automaton moves if it was in the state qn and sees the symbol sm; and
- a Boolean array final[n] whose elements describe, for each state qn, whether this state is final or not.
When simulating a finite automaton, your program needs to keep track, at each moment of time, of the current state. Initially, the state is q0 -- which is described by number 0.
Turn in:
- a file containing the code of the method, and
- a file containing the result of testing this method.
Related Book For
Accounting Information Systems
ISBN: 9780132871938
11th Edition
Authors: George H. Bodnar, William S. Hopwood
Posted Date: