[This is an optional and individual assignment, NOT teamwork. You are not required to complete…
[This is an optional and individual assignment, NOT teamwork. You are not required to complete this one. You may get up to 30 extra points total if you complete it. Late submission is not accepted or graded.]
A “goods train” is defined to be a string of cars, which must begin with one or two engines. These are followed by one or more trucks, which are followed by one Guard Van.
E E T T T T G
E T T T
E E E T T T G
a. [5 extra points] Write a DFA to recognize a goods train. Use E = engine, T = truck, G = guard van.
b. [5 extra points] Write a regular expression that generates all legal goods trains.
c. [20 extra points] Write a program that recognizes goods trains (says “Accept’ or “Reject”). (Input can be in any convenient form.)
You must use your DFA and translate DFA to code. You can decide how to represent the states and transitions in your program.
Programming language can be C++ or Java or Python.
Run your program! Submit code (short please) and outputs.