Part A (12 points) Tasks: You need to implement a java class with JUnit test to
ID: 3752493 • Letter: P
Question
Part A (12 points) Tasks: You need to implement a java class with JUnit test to find whether a given binary string input can be divisible by 4 and 3 at the same time. First, you need to create DFA or NFA for the question. If you create NFA, you need to convert it to DFA After that, minimize DFA After you have DFA, you can implement by following state transition version or by using table transition to implement it in Java. If the giving binary string is divisible by both 4 and 3, then the java program should print true, otherwise false.Explanation / Answer
Transition table for above table
So the idea behind this transition table is a number can produce 0 to 11 remainders when divided by 12 so that's why there are 12 states in DFA transition table.
each state corresponds to the remainder it will produce i.e q0 means remainder is 0 q1 means remainder is 1 ans so on.
so numbers which will produce given reaminder are
q0: 0, 12, 24, and so on
q1: 1, 13, 25 and so on
q2: 2, 14, 26 and so on
q3: 3, 15, 27 and so on
q4: 4, 16, 28 and so on
q5: 5, 17, 29 and so on
q6: 6, 18, 30 and so on
q7: 7, 19, 31 and so on
q8: 8, 20 , 32 and so on
q9: 9, 21, 33 and so on
q10: 10, 22, 34 and so on
q11: 11, 23, 35 and so on
Program
}
JUNIT TEST
States 0 1 q0 q0 q1 q1 q2 q3 q2 q4 q5 q3 q6 q7 q4 q8 q9 q5 q10 q11 q6 q0 q1 q7 q2 q3 q8 q4 q5 q9 q6 q7 q10 q8 q9 q11 q10 q11