Assignment 7, due Oct 13

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

Assignments are to be turned in on paper. On every assignment, write your name, course and section number at the top. Write your name as it appears in your university records! Use the section number for which you are registered! We will not do detective work to figure out who did what. Work must be legible. Homework is due on paper in discussion section, usually at the start except when the assignment indicates that time to work on the assignment will be provided in class. Exceptions will be made only by advance arrangement with your TA (excepting "acts of God" outside your control). Never push homework under someone's door!

  1. Background: The following have to do with problems some students had on the exam.

    a) If a is an array, you can write a[i] to select the ith element of the array. How do you select the ith element of the list x? (0.5 points)

    b) When you type the shell command java Roadnetwork 2>somefile what does the 2>somefile at the end of the command do? (0.5 points)

  2. Background: Look at the code at the end of Lecture 14 from Oct. 10. There is a lambda expression in the initializer for the static variable eventSet.

    A question: What is that lambda expression used for? (0.5 points)

  3. Background: At the end of Lecture 14 from Oct. 10., two simulation frameworks were given.

    a) Write code to schedule a call to System.exit(0) at time 100.00 using the first framework. (0.5 points)

    b) Write code to schedule a call to System.exit(0) at time 100.00 using the second framework. (0.5 points)

    c) Rewrite the code from part b without using lambda notation, anonymous subclasses or anonymous variables. (0.5 points)