Question: [JAVA TURING MACHINE] public class Project10 { public static void main(String[] args) { String[] delta = { q0 a q0 _ R, q0 _ q1
[JAVA TURING MACHINE]
![[JAVA TURING MACHINE] public class Project10 { public static void main(String[] args)](https://dsd5zvtm8ll6.cloudfront.net/si.experts.images/questions/2024/09/66f66ce068569_75966f66cdfd8b26.jpg)
public class Project10
{
public static void main(String[] args) {
String[] delta = {
"q0 a q0 _ R",
"q0 _ q1 _ R",
"q0 b q2 b L",
"q1 a q1 a R",
"q1 _ q3 b R",
"q1 b q2 a R"
};
TM turing =
new TM(delta, "q0", "q2", "q3");
turing.run("aabb");
System.out.println();
turing
.run("aa");
}
}
Implement the following Java class TMto simulate a deterministic Turing machine. public class TM public TM (String delta String go String ga String gr) public void run (String w States are represented by alphanumeric strings. A Turing machine is specified by the parameters to the constructor. The array delta defines the transition function. Each string in delta has the form "g X p Y D", representing a transition from state q to p with the label X- Y,D. The parameters go, ga, and ar define the start, accept, and reject states respectively. The blank symbol is represented by the underscore The method run simulates the computations of the TM on the input w and prints the sequence of configurations to the console. If the TM halts, it also prints "ACCEPT" or "REJECT". A test program and its output are shown below goaabb public class Project10 public static void main (String LJ args) f goabb String delta gobb q2 bb go a q0 R'' ACCEPT R" go b g2 b L'' goaa. q1 a q1 a R goa q1 3 b R "gl b g2 a R'' q1 bq3 TM turing new TM (delta "go", "q2", "q3"); REJECT turing. run aabb"); System. out. println i turing run ("aa")
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
