Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

L={w{a, b}*:w contains no more than one b}. L is accepted by the following DFSM M: We can simulate M by the following program: While

L={w{a, b}*:w contains no more than one b}. L is accepted by the following DFSM M:

We can simulate M by the following program:

While (true)

{

S: c= read char()

If( c== EOF) print yes;

else if ( c== a) go to S;

else if (c==b) go to T

T: c= read char()

If( c== EOF) print yes

else if ( c== a) go to T

else if (c==b) print no

}

This above note is just an english version of the java code. I need a java code that runs L using the above while loop. look at the picture posted for more information as to how to continue the code.

image text in transcribed

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: l. Read in the start tate, the final states, and the transitions of the input DSFM. (no need to read| K or since the transitions would imply those) -Use a Vector String to store the set of final states. . Use a Vector to store the set of tansitions. 2. Determine if an input string is accepted or rejected based on algorithm dfsnSimulate. String methods such as sta With, and substring are useful . The following run is for the DSFM deseribed in Ex2-4-1: nter final states, 1 on each line. Enter to end; nter trons itions, 1 *nach line with no ws 1 state, letter,state. Enter 0,8,0 to end: b.t nter input string. enter done to endia nter input string, enter done to end:ab ccept er input string, nter, dare to nd:ahb eject nter input string. enter done to end:aba ccept nter input string, enter done to erd :abda ccept nter input string. enter done to end:abbb nter input string, enter done to end:b ccept er input #tring, enter done to end:hb eject

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Genomes And Databases On The Internet A Practical Guide To Functions And Applications

Authors: Paul Rangel

1st Edition

189848631X, 978-1898486312

More Books

Students also viewed these Databases questions

Question

10. Identify the atonement with the father in Pinocchio.

Answered: 1 week ago