Question: 1 Write a Java program to read in a DSFM, then decides if an input string is accepted by the DSFM or not. You

1 Write a Java program to read in a DSFM, then decides if an input string is accepted by the DSFM or not. You can assume the input DSFM is legal, and states are named with single letters. Note: The program has 2 parts: 1. Read in the start state, the final states, and the transitions of the input DSFM. (no need to read K or I since the transitions would imply those) Use a Vector to store the set of final states. Use a Vector to store the set of transitions. 2. Determine if an input string is accepted or rejected based on algorithm dfsmSimulate. String methods such as startsWith and substring are useful. The following run is for the DSFM described in Ex2-4-1: Enter start state:s Enter final states, 1 on each line. Enter to end: Enter transitions, 1 on each line with no ws: state, letter,state. Enter 8.8.8 to end s.b.t tract Enter input string, enter done to end: a Accept Enter input string, enter done to end: ab Accept Enter input string, enter done to end:abb Enter input string, enter done to end: aba Enter input string, enter done to endiabaa Accept Enter input string, enter done to end:abbb Reject Enter input string, enter done to end: b Accept Enter input string, enter done to end:bb Reject Enter input string, enter done to end: done
Step by Step Solution
3.49 Rating (152 Votes )
There are 3 Steps involved in it
Answer and step by step explanation Part 1 import javautilScanner import javautilVector public class ... View full answer
Get step-by-step solutions from verified subject matter experts
