Question: Please help me with this lab in Java. TIA Moore Machine Create a Java program which implements this Moore machine . Requirements 1. The program
Please help me with this lab in Java. TIA
Moore Machine Create a Java program which implements this Moore machine .
Requirements 1. The program must be written in Java .
2. It must request the initial s tate and the in put. It displays the machine s output and the final state , as in the example below.
3. The input is a string of zeros and ones o nly.
4. If the initial state or input i s invalid , an error message is produced. The program may, but is not required to use Java exceptions in this case
5. T he program must implement the entire Moore machine, n ot just the inputs below . The instructor will test it with different input
Hint : There are many different ways to do this , but consider usi ng an array of state objects . One way is to declare this class,




too] 0 [01] 0 [10] Upload: Your Java (.java) file Sample Output Please enter the initial State: Please enter the input: The output is: 10 00 10 00 The final State is: A FR Please enter the initial State: Please enter the input: 10010100 The output is: 00 10 11 10 00 01 11 10 11 The final State is: C // This class represents one state in a Moore machine public class Moore private char state; private String output; int zero; int one: // The name of the state // The output displayed when this state is entered // The index of the next state given an input of 0 // The index of the next state given an input of 1 // Public constructors and methods here Then in main you can create the array of states like Moore l mooreStates new Moore I51: mooreStates [0] = new Moore (' ', '''', 0, 0); moorestates[1] new Moore('A, "00 ", 2, 4) mooreStates [2] = new Moore ('B', "01 ", 2, 3); mooreStates [3] = new Moore ('C", "11 ", 4, 3); moorestates [4]new Moore ('D', "10 ", 3, 1)
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
