Question: foundations of computer science computer operating systems homework 02 input...
Foundations of Computer Science: computer operating systems
Input file of test cases: ( Below) If your program works correctly according to the specifications, then you should be able to pipe [ https://en.wikipedia.org/wiki/Pipeline_(Unix) ] in this file to run all of the test cases. The “y” and “n” in the input file do not represent that the string is in the language or not. Instead, “y” tells your program to read another input string, and “n” tells your program to stop; see the program specifications in Section 4 of the assignment. You do not have to use the input file to run the test cases, but the input file is provided just to make it easier to run them all using a pipe. Also, you don’t have to use pipe, but it can make it easier when debugging to run all of the test cases without having to type them all in.
y y y y cdef@.com y y ..com y y . y redblue@green..com y random@com y y y y y @ y y y @abcde.com y people.dog.cat@.com y n
You must write your program in either C, C++, Java, or Python. All input/outputmust be through standard input/output, and your program is to work as follows:
Your program next asks the user if s/he wants to enter a string. The user thenenters “y” for “yes”, or “n” for “no”.If the user enters “n”, then the program terminates.If the user enters “y”, then the user is prompted to enter a string overΣ.
3. If the user chooses to input a string, your program then readsin the string. Afterreading in the string, your program prints it.
Then your program processes theentirestring on the DFA, one character at a time, in the following manner.Your program must begin in the start state of the DFA and print outthename of that state (q1orq0). After each character from the string is processed on the DFA, your programmust print out the character and the name of the current state of the DFA.Even if your DFA is in a trap state, your program must do this for eachcharacter in the string until it reaches the end of the string.To simplify your program, you can check the ASCII code of each character of thestring and process on the DFA accordingly.
4. After processing the entire string on the DFA, your program must indicate if thestring is accepted or rejected based on the state in which the DFA ended. Yourprogram then should return to step 2.