Assignment 4, due Sep 15
Part of
the homework for CS:2820, Fall 2017
|
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!
a)
System.out.println( "Start" ); for (int i = 1; i < 10; i++) { System.out.println( "i = " + i ); } System.out.println( "End" );
b)
for (Road r:roads) { System.out.println( r.toString() ); }
a) Give an appropriate declaration for the list of roads inside class Road. (0.3 points)
b) Give the code you would use inside the Road constructor so that the constructed road automatically adds itself to the list. (0.3 points)
c) The main class still needs to iterate over all the roads in order to print out the textual representation of the road network. Suggest how class roads could permit this without exporting the list itself. (0.4 points)
a) Identify all of the distinct paths through this code. (0.5 points)
b) Describe how you could test these paths using input to the road-network program. Merely giving the input file(s) is not sufficient without an explanation of how what each input file or each input line tests. (0.5 points)