Question: Implement the following Java class TM to simulate a deterministic Turing machine. public class TM { public TM(String[] delta,String q0, String qa,String qr) public void

Implement the following Java class TM to simulate a deterministic Turing machine.

public class TM {

public TM(String[] delta,String q0, String qa,String qr)

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 q X p Y D, representing a transition from state q

to p with the label D Y X , . The parameters q0, qa, and qr define the start, accept, and reject states respectively.

The blank symbol is represented by the underscore _.

The method run simulate s the computations of the TM on the input w and print s the sequen ce of

configurations to the console. If the TM halts, it also prints ACCEPT or REJECT.

A test program and its output are shown in the picture below:

Implement the following Java class TM to simulate a deterministic Turing machine.

public class Project10 public static void main (String I args) String delta go a go R", q1 q1 a q1 a R q1 q3 b R q1 b q2 a 11 TM turing new TM (delta "go", "g2 ''q3''); turing. run ("aabb" System. out. println turing run aa"); goaabb goabb gobb q2 bb ACCEPT goaa goa go REJECT public class Project10 public static void main (String I args) String delta go a go R", q1 q1 a q1 a R q1 q3 b R q1 b q2 a 11 TM turing new TM (delta "go", "g2 ''q3''); turing. run ("aabb" System. out. println turing run aa"); goaabb goabb gobb q2 bb ACCEPT goaa goa go REJECT

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!