Machine Problem 3, due Oct. 9

Part of the homework for CS:2820, Fall 2017
by Douglas W. Jones
THE UNIVERSITY OF IOWA Department of Computer Science

Write a Java program, in file Logic.java that meets all of the requirements for MP2 and also supports the following gate types:

and
or
Each gate has inputs named in1 and in2 and one output named out.

not
Each gate has one input named in and one output named out.

const
This has outputs named true and false and no inputs

Wires may connect outputs to inputs. Each output may be connected to zero or more inputs, with each connection made by a distinct wire. Exactly one wire must connect to each input. Any attempt to connect inputs or outputs with names that are not supported by that kind of gate must be detected as an error.

In addition to checking the above correctness criteria, your program must be resiliant in the face of input errors of the sort that MP2 was expected to handle, and because you now have access to a ScanSupport class, it your code should work better than your code for MP2.

As with MP2, your program should generate either error messages to standard error or output a reconstruction of the circuit to standard output. All error messages should reasonably document the error.

Grading criteria: No credit will be given to programs that do not represent a substantial attempt at meeting the requirements of this assignment. Your program must:

Note that MP4 will involve extending MP3 to simulate the behavior of gates, so planning for this, while not part of this assignment, may simplify the next.

Note that the requirements for header comments in the file header are absolute. Your name must appear in the form that it appears on your ID card. The TAs will not waste their time doing detective work to attempt to figure out who submitted what code.

Submission: Your solution should consist of a single file named Logic.java, with a public method, main. (We will chop the file into smaller more managable pieces later, as it grows.)

To submit your solution, use the submit Logic.java shell command while your current directory is the one holding the source file. The dialogue with the submit command will be similar to that you used with MP1 and MP2, except that you will use mp3 in the dialogue.