Assignment 11, due Nov. 13

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

On every assignment, write your name legibly as it appears on your University ID card! Homework is due on paper at the start of class on the day indicated (usually Friday). Exceptions will be made only by advance arrangement (excepting "acts of God"). Late work must be turned in to the TA's mailbox (ask the CS receptionist in 14 MLH for help). Never push homework under someone's door!

  1. Background: A popular wrong answer on exam 2 was to suggest that the Output.outputChange() method was the right place to put "do it once" logic (such as, if(!done){outputHeaders();done=true}) to print the output heading and start the logical process to print all the outputs once per time unit.

    A Problem: Give an example circuit that clearly demonstrates the inadequacy of this solution, either because it would produce no output or because it would produce misleading output. (The circuit need not have complex or interesting behavior -- the only thing it must do is demonstrate the incorrectness of the proposed solution.) (1 point)

  2. Background: The code distributed to set people up to do MP5 uses very simple logic to stop the reading of the circuit description so that the input gates can read the input file using the same scanner.

    A Problem: Find and explain this logic. (1 point)

  3. Background: With the output gates, it was natural to make the displayOutput() method static because its job was to traverse the list of all output gates and print all their values at one instant of simulated time. Note that the choice between a static method and gate-specific outputChange() events was the result of a constraint on the output of the program, not a choice that followed from some internal aesthetic.

    A Problem: With input gates, is there a need for a similar static readInput() method, or should this job be done by some kind of inputChange() event that is specific to one particular input gate at a time? Explain why. (1 point)