Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Overview The purpose of this assignment is to broaden your understanding of the acceptance relation for deterministic finite automata. Recall that a string w is
Overview The purpose of this assignment is to broaden your understanding of the acceptance relation for deterministic finite automata. Recall that a string w is accepted by a DFA M, if and only if there exists a path from the start state of M to some final state in M labeled by the constituent characters of w. In this assignment you will implement a program in Java which will accepts as its input the name of a file containing a list of strings and will determine whether or not they are accepted by a specific automaton. Specification Define a program called DFACheckBasic which will accept as its input the name of a file containing a collection of strings and determines which of them are accepted by the deterministic finite automaton, M, shown in the figure below. 0 0 bo B E 0 0 0 start {0,1} 1 1 0 0 c H Input File Specification For this assignment you may assume that the input file is formatted with exactly one string per line and that the strings are guaranteed to be formed from characters of the input alphabet {0, 1}. As an example, the following is one possible input file: 1 2 100100 111 00100100 10101 3 4 5 01010101 Usage The program DFACheckBasic is intended to be run via the following command-line invocation: 1 $ java DFACheckBasic input.txt If no input file is specified or if the input file is not found, an appropriate error message must be display. For example: 1 $ java DFACheckBasic DFACheckBasic: no input file specified 2 3 4 $ java DFACheckBasic no-such-file.txt DFACheckBasic: the file 'no-such-file.txt' could not be opened 5 If a valid file is specified as input, then for every string in the file you should output both the string and the word accepted if M accepts it and rejected otherwise, with only one string's results given per line. Using the file input.txt mentioned above, your program should behave as follows: 3 1 $ java DFACheckBasic input.txt 2 100100 accepted 111 accepted 00100100 accepted 10101 rejected 01010101 rejected 4 5 6 Compilation Notes Your program must compile using the following command-line invocation: 1 $ javac *.java Do not submit any IDE specific files and in the interest of simplicty do not use packages for this assignment. If your program does not compile using the command mentioned above you will receive no credit. Overview The purpose of this assignment is to broaden your understanding of the acceptance relation for deterministic finite automata. Recall that a string w is accepted by a DFA M, if and only if there exists a path from the start state of M to some final state in M labeled by the constituent characters of w. In this assignment you will implement a program in Java which will accepts as its input the name of a file containing a list of strings and will determine whether or not they are accepted by a specific automaton. Specification Define a program called DFACheckBasic which will accept as its input the name of a file containing a collection of strings and determines which of them are accepted by the deterministic finite automaton, M, shown in the figure below. 0 0 bo B E 0 0 0 start {0,1} 1 1 0 0 c H Input File Specification For this assignment you may assume that the input file is formatted with exactly one string per line and that the strings are guaranteed to be formed from characters of the input alphabet {0, 1}. As an example, the following is one possible input file: 1 2 100100 111 00100100 10101 3 4 5 01010101 Usage The program DFACheckBasic is intended to be run via the following command-line invocation: 1 $ java DFACheckBasic input.txt If no input file is specified or if the input file is not found, an appropriate error message must be display. For example: 1 $ java DFACheckBasic DFACheckBasic: no input file specified 2 3 4 $ java DFACheckBasic no-such-file.txt DFACheckBasic: the file 'no-such-file.txt' could not be opened 5 If a valid file is specified as input, then for every string in the file you should output both the string and the word accepted if M accepts it and rejected otherwise, with only one string's results given per line. Using the file input.txt mentioned above, your program should behave as follows: 3 1 $ java DFACheckBasic input.txt 2 100100 accepted 111 accepted 00100100 accepted 10101 rejected 01010101 rejected 4 5 6 Compilation Notes Your program must compile using the following command-line invocation: 1 $ javac *.java Do not submit any IDE specific files and in the interest of simplicty do not use packages for this assignment. If your program does not compile using the command mentioned above you will receive no credit
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started