Question: In java Write and test a method that simulates a general finite automaton. Your program should enable the computer to simulate any given finite automaton
In java
Write 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.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
