I would like some assistance correcting an issue I am having

with this assignment.

Once a finite state automaton (FSA) is designed, its transition

diagram can be translated in a straightforward manner into program

code. However, this translation process is considerably tedious if

the FSA is large and troublesome if the design is modified. The

reason is that the transition information and mechanism are

combined in the translation.

To do it differently, we can design a general data structure

such as a table or a list to hold the transition information, and

to implement in program code only a general transition mechanism.

Using this approach, the resulted program is not only smaller, but

it can also be modified easily to simulate a different FSA by just

changing the transition information and the general data structure

holds. We shall refer to such a program as a universal finite

state automaton.

Your job for this assignment is to implement such a universal

finite state automaton. To convince you that it is very easy to do

so, I have suggested an algorithm below; however, you are free to

modify it. Note that your program has to be designed to handle the

FSA where the input transition function is partial, which means

there is a default dead-end, or trap state.

1 state = initial_state; exit = false;

2 while not exit do

3 begin

4 symbol = getNextSymbol();

5 if symbol is in alphabet then begin

6 state = getNextState(state, symbol);

7 if state is dead_end then begin exit = true; reject; end

8 end

9 else begin

10 exit = true;

11 if symbol is not the endmarker then reject;

12 else if state is final then accept;

13 else reject;

14 end //if

15 end //while

The above algorithm shows how to process one input string and

correctly determine

whether the string is in the language. You need to augment the

algorithm so that your program is able to read in different FSA

descriptions from an input file and simulate one machine at a time

with any number of test strings.

You must represent each FSA in the input file with the following

format, and put all input machines in one file:

(1) The number of states, say N.

For ease of implementation, number states from 0 to N-1, with 0

representing the initial

state, and N the dead-end state.

(2) The set of final states.

You need a boolean array FINAL [0..N-1].

(3) The alphabet.

Symbols in the alphabet should be numbered internally so that the

value returned by the

function getNextSymbol is an integer.

(4) A sequence of transitions of the form (p a q).

The triple (p a q) means that in state p, looking at input symbol

a, the FSA will change

its state to q. For this project, store this information in a

table, say next_state, so that the value returned by the function

getNextState is next_state [state, symbol].

Test your program with the following 5 finite state automata

using the given test strings.

(1) A FSA which recognizes the set of all binary strings with at

most one pair of consecutive 0s and at most one pair of

consecutive 1s. Strings: _, 00, 0011, 110011,

010101, 000, 00102, 1100101, 10110100101, 1001011010110

(2) A FSA which recognizes email addresses. A valid email

address is defined as follows: [email protected],

where the user name consists of at least one symbol with any

combination of letters, digits, hyphens, underscores, or periods.

The server name is any string of at least one symbol with any

combination of letters, digits, hyphens, and underscores. The

domain name must have 2 to 4 letters. Strings:

[email protected], jsmith, [email protected], [email protected],

[email protected], jsmith.edu, [email protected],

[email protected], [email protected],

[email protected]

(3) A FSA which recognizes all identifiers that begin with a

letter (both upper and lower), an underscore, or a dollar sign,

followed by any combination of letters, digits, underscores, and

dollar signs. Strings: a, $, _, TAX_RATE, $amount,

week day, 3dGraph, X3y7, _finite_automaton, X*Y

(4) A FSA which recognizes the set of all signed or unsigned

decimal numbers without superfluous leading or trailing zeros. For

instance, 0.0, -0.5, +120.01, and 123000.0 are in the language, but

0.00, 00.5, and 0123.4 are not. Each decimal number has the form of

A.B, where A and B are strings of digits and they cannot be empty

at the same time. Strings: +1.23, -.123, 123.,

-0.0, 01234.5, +789, ., 56.30, +120.0001, 123000.0

(5) A FSA which recognizes the set of strings over {0, 1, 2}

such that the final digit has not appeared before.

Strings: 0, 01, 012, 22, 2102, 0221, 01012,

120120, 110221210, 0202321

Sample input of a FSA: 2

1

01

(0 0 0) (0 1 1) (1 0 1) (1 1 0) 1000 10001 ……..

Corresponding output:

Finite State Automaton #1.

(1) number of states: 2 (2) final states: 1

(3) alphabet: 0, 1

(4) transitions:

000 011 101 110

(5) strings: 1000 accept

10001 reject

……..

here is current code, but doesn’t seem to be working properly.

Some strings that I should be accepting are being rejected

public class Transitions {

public String currentState, nextState, sign;

}

package cs311;

import java.io.*;

import java.util.ArrayList;

public class Automation {

public static ArrayList

Why Work with Us

Top Quality and Well-Researched Papers

We always make sure that writers follow all your instructions precisely. You can choose your academic level: high school, college/university or professional, and we will assign a writer who has a respective degree.

Professional and Experienced Academic Writers

We have a team of professional writers with experience in academic and business writing. Many are native speakers and able to perform any task for which you need help.

Free Unlimited Revisions

If you think we missed something, send your order for a free revision. You have 10 days to submit the order for review after you have received the final document. You can do this yourself after logging into your personal account or by contacting our support.

Prompt Delivery and 100% Money-Back-Guarantee

All papers are always delivered on time. In case we need more time to master your paper, we may contact you regarding the deadline extension. In case you cannot provide us with more time, a 100% refund is guaranteed.

Original & Confidential

We use several writing tools checks to ensure that all documents you receive are free from plagiarism. Our editors carefully review all quotations in the text. We also promise maximum confidentiality in all of our services.

24/7 Customer Support

Our support agents are available 24 hours a day 7 days a week and committed to providing you with the best customer experience. Get in touch whenever you need any assistance.

Try it now!

How it works?

Follow these simple steps to get your paper done

Place your order

Fill in the order form and provide all details of your assignment.

Proceed with the payment

Choose the payment system that suits you most.

Receive the final file

Once your paper is ready, we will email it to you.

Our Services

No need to work on your paper at night. Sleep tight, we will cover your back. We offer all kinds of writing services.

Essays

No matter what kind of academic paper you need and how urgent you need it, you are welcome to choose your academic level and the type of your paper at an affordable price. We take care of all your paper needs and give a 24/7 customer care support system.

Admissions

Admission Essays & Business Writing Help

An admission essay is an essay or other written statement by a candidate, often a potential student enrolling in a college, university, or graduate school. You can be rest assurred that through our service we will write the best admission essay for you.

Reviews

Editing Support

Our academic writers and editors make the necessary changes to your paper so that it is polished. We also format your document by correctly quoting the sources and creating reference lists in the formats APA, Harvard, MLA, Chicago / Turabian.

Reviews

Revision Support

If you think your paper could be improved, you can request a review. In this case, your paper will be checked by the writer or assigned to an editor. You can use this option as many times as you see fit. This is free because we want you to be completely satisfied with the service offered.