Assignment 11, due Apr 21

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

On every assignment, write your name and section number. Write your name as it appears on your university ID card! Use the section number as it appears in your current registration! We will not do detective work to figure out who did what. Homework is due on paper at the start of your discussion section. Exceptions will be made only by advance arrangement with your TA (excepting "acts of God"). Never push homework under someone's door!

  1. Background: The assignment for MP5 created two changes in the behavior of the logic simulator: First, the output was changed from a textual listing of events to a graph of the output values of gates. Second, instead of stopping when the logic circuit reached a steady state, the program went into an infinite loop.

    A problem: Explain why it went into an infinite loop. (0.5 point)

  2. Background: On the exam, several people suggested declaring a method to be abstract final.

    A problem: Explain the problem this creates. (0.5 point)

  3. Background: A mathematician might define the successor function as succ(i) = i + 1. In Java, this function would have to be a method. The abstract definition of this method would be something like:
    static abstract int succ( int i );
    

    a) Give Java code that implements this function. Assume this is in a context where it can be done. (0.5 point)

    b) Give Java code that evaluates this function. Assume this is in a context where it can be done. (0.5 point)

  4. Background: Look at class Simulation from the posted solution to MP4.

    A problem: List (in the order they occur in the code) all of the declarations in this code that can be marked as final. (1.0 points)