To design a standard Turing Machine as a micro calculator to perform two operations: / (division) and - (subtraction).
Objective:
The Turing machine is supposed to perform two operations on positive integers (including 0 represented in unary notation). We represent the number zero by the symbol 'o'. The input numbers are separated by a single '#'. The operations are division and subtraction. The division operation is, in fact, integer division (Java modulus operator %). We just need the quotient, not the remainder. We input the operations in prefix format (e.g.:/111#11). The symbols used are {0, 1, #, -, /}. You can add more symbols if needed. The output contains only 0 (zero), 1, - (minus for negative numbers), or e. The symbol 'e' in the output represents an error status. For any input not described by one of the above 2 operations, your program should return "e" as its answer. That is, if the number is not in a valid format, or if there is not exactly one of the two operators, you should reject the input by showing 'e' in the output. For more information, see the examples below.
Technical Notes:
1. The read-write head should move right until the first blank (excluding).
Example: if the tape ends up with ...== abcd = ef, and the read-write head is on the letter c, then the output is cd. (You will see this if you test your Turing machine as a transducer.)
2. You are allowed to use "s" = stay as the move operation.
3. You are not allowed to use block features of JFLAP. All programs should be in one file and on one page.
4. The look of the design is important. Organize your design in such a way that it shows the different modules clearly. Also, use appropriate notes on the page for documenting your code.
Examples:
Input Output Comment
Subtraction:
-11111#111 11
-111#111 0 11 111 0 11 11 1 1 0 0 e e
-111#11111 0#111
The first number is zero.
-0#0 Both numbers are zero.
-11#0 Second number is zero.
Division:
/1111#11 /111#111
/111#11 /111#1111 /0#1111
First number is zero. Second number is zero.
/11#0 /0#0 -/11#111 +11#111/ /110111# 11#111
Both numbers are zero.
Anything Else:
These are just a few examples.
e e e e
'e' means 'error'.