Name: ____________________________________________________ Alpha: _____________________

Describe help received: _________________________________________________________________

Problem 1

Draw the 5-tuple representing the machine
 

Problem 2

Draw (with paper and pencil) the machine represented by the five-tuple: \[ \left( \{1,0,x\}, \{a,b,c\}, 1, \begin{array}{c|ccc} &a&b&c\\ \hline% 1&1&1&0\\ 0&1&x&x\\ x&x&x&x \end{array}, \{1,0\} \right) \]
 

Problem 3

Write a C++ or Java implementationof the Problem 1 machine. It should read in a string from stdin and write "accept" or "reject" to stdout and write absolutely nothing else (unless there's an error). Call your program HWSol.cpp.
$ ./gohwsol
acca
accept
$ ./gohwsol
caba
reject
$ ./gohwsol 
accbabcbbcbaa 
reject

Turn in a printout of the source code of your program, and submit your program using the submit system (submit system help) you should know from IC210/SI204 as:
~/bin/submit -c=SI340 -p=hw05 HWSol.cpp
If you program in a language other than C++, turn in a screen capture of your program running with the following examples (make sure you get the right answers!)
careject
cacreject
cababbbccreject
cababbccaccept
cababbbcaccept
cacbaccept
cacbbaaccept

Note: If you're really ambitious, try writing a program that is able to read in a description of a finite automaton from a file (you can make up any file format you like) and simulate that automaton, rather than hardcoding a single machine into the class. It would be really cool if you could read in a JFLAP .jff file. I'll give you extra credit for this.