Question: 4 Program Specifications You must write your program in either C, C++, Java, or Python. All input/output must be through standard input/output, and your program
4 Program Specifications
You must write your program in either C, C++, Java, or Python. All input/output must be through standard input/output, and your program is to work as follows:
Your program first prints:
Project 1 for CS 341
Section number: the section number you are enrolled in Semester: Spring 2023
Written by: your first and last name, your NJIT UCID Instructor: Marvin Nakayama, marvin@njit.edu
Your program next asks the user if they want to enter a string. The user then enters 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 .
If the user chooses to input a string, your program then reads in the string. After reading in the string, your program prints it. Then your program processes the entire string 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 out the name of that state (q1 or q0).
After each character from the string is processed on the DFA, your program must 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 each character 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 the string and process on the DFA accordingly.
After processing the entire string on the DFA, your program must indicate if the string is accepted or rejected based on the state in which the DFA ended. Your program then should return to step 2.
Test Cases
4.
Test your program on each of the following input strings:
1. f8o9o@ab32cdef.edu 2. z@e.edu
3. ba@ba.ed
4. edfg@.edu
5. web2web.a.c97c.edu@j.k68c42.educate.edu 3
6. fo8o@goo2.edu..edu
7. ab67qe.@boom.edu
8. edu2c@computer56.educate 9. redblue@green..edu
10. random6@edu
11. p654aa7e@a896.edu.edu
12. www@a89.edu.educ
13. wwwb@bb91a.edu.ed
14. 34big.edu@bbdef29.edu
15. food@for.edu@
16. net.a.b.4c@comma3.edu.edu
17. net84work.abb@common.6edu.edu 18. @abcde.edu
19. people5.d7og.c8at@c.edu3.edu 20. cable..cord@fort.edu
You must create an output file containing your programs output from each test case in the order above.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
