Sample code listings from 22c020, Summer 2001


Links to code


added 6-6-01The code for MyClass from class.
added 6-6-01The code for MyClass with a public main
added 6-6-01The code for MySub from class.
added 6-6-01The code for MySub with a cople of extra compute methods that are equivalent, and a main added for testing. The return in the original compute is required by the syntax of java (logic also dictates its precens) remove the return and recompile to see the error.
added 6-7-01The complete code for the solid classes that demonstrate and a demonstration of inheritance, upcasting, and downcasting.
added 6-8-01A re-write of the Solid class so that the Solid class is an abstract class The only other change in the program is the way that temp is declaired in the main method.
added 6-11-01A set of classes that outline the use of interface and abstract classes. I would suggest downloading and adding functions to this set of classes to understand what is going on.
added 6-12-01This is the first version of the Elevator class. In this example the Elevator is a driver and the button and car class are out side.
added 6-12-01This is the Second version of the Elevator class. In this example the Button and Car classes are nested within the Elevator class and an new driver class Elevator_1 has been created.
added 6-13-01This is the Third version of the Elevator class. Button is nested in Car and Car is nested in Elevator
added 6-13-01This is the Chief program that demonstrates nesting and how private affects visablity.
added 6-14-01The raw IO demo (process a character at a time), this is about as low a level program as you can use in JAVA so lots of work to clean up the data.
added 6-14-01 updated 6-18-01The Second IO demo program -- this is not bug free but rather a ruff start to building a proper IO class for any program.
added 6-15-01This is the program from quiz2 notice that the statement that would cause compilation problems has been remarked out
added 6-18-01The second version of the chief, please note how the Helpupdate 2 is handled. The HelpShow class is much neater.
added 6-20-01This is the one that covers opening a file for reading or writing and then closing
added 6-26-01A basic (very primative) application using a bit of swing, The title text is read from the command line.
added 6-26-01A basic set of colors and fonts in a JPanel, note the correction for the use of true/false in the 3drectangle.
added 6-29-01Code that counts the number of times the yes or no button has been battered.
added 6-29-01This is Punch_Buttons modified to use the WindowListener interface to close the application when the window closes.
added 6-29-01This is Punch_Buttons modified to close on exit to do this it extends WindowAdapter.
added 7-02-01This is the program that changes the background color from the 3 buttons.
added 7-03-01This is program is the version that tosses lots of errors and basicaly does not work unless all of the syntax is exactly correct.
added 7-03-01This is the version of the program breaks a file up into words, same logic just with lots of exception handles.
added 7-03-01This is the simple recursive print msg program.
added 7-03-01This is the code Fibinnachi sequence code, it can take 1 interger argument on the command line and then it will calculate the results by both recursive and iterative methods or it will take to
Fib int show_calls and in this case it will show the depth of the call stack.

added 7-04-01This code demonstrates the moving data between 2 lists updating information amonst other things.
added 7-06-01This is a place to start Project 3 from if you project 1 or 2 did not work out. It reads a file (ignors all non memos) and creats and array of these memos. It also updates the arrary size when it starts to run out of space.
added 7-07-01This demo illistrates a large number of things:1) opening new windows from within action handlers 2)updating windows and button behavior from withing action handlers 3)passing arrays as arguments and getting them back via the same method. This code will be updated with comments durring the day on Saturday.
added 7-08-01This is the code from Quiz4 if you wish to try it out.
added 7-10-01Code from class that creates to binary files (1 of floats and the other of integers) and then reads them with as various other types (not as a double there are only 40 items but a char produces 160).
added 7-11-01This is the base converter I talked about in class.
added 7-11-01This is the serialized version of the memo class note the new constructor that re-indexes a memo and note that the unique id variables are now transient saving could cause a problem.
added 7-12-01This is the starter code for project4.
added 7-14-01This is the code from exam 2 question 2 I have commented out the one problem in the code but this would not have material affected running the code.
added 7-16-01This is the code that will send out a text stream and get back the same.
added 7-17-01(Sender) This is the code that will send data over the network to the reciever it uses the objectwriter rather than sending the text.
added 7-17-01(Receiver) This is the counter part to the sender code in that it acts as a receiver.
added 7-19-01This is the talk program that combines listening and sending over the net at the same time it is not multi-threded but behaves this way some what.
added 7-20-01This is the code where threads are created from a class that extends the Thread class.
added 7-20-01This is the code where threads are done by implementing the Runnable interface.
added 7-20-01This is the code that demos setting up a color grid (5x5) and having 25 threads one for each square that randomly picks the next color for a given square.
added 7-21-01This is a threaded Fib calculator the take home quiz on monday will be over this code.
added 7-23-01This is the code that demonstrates wait and notify with 2 producers and 2 consumers.
added 7-24-01A starting place for project5 prepared by Ting. You will need to download and unzip this it is a compressed archive.
added 7-24-01A starting place for project5 prepared by Edward. a 10x10 grid of colors each controled by its own thread, each grid will 10% of the time pick a bright color or 90% be the average of its neighbors, this is actualy somewhat pleasing to watch.
added 7-25-01A demo of both an array list and a linked list -- should be the last code posted for the term.
Edward W Sihler (esihler@cs.uiowa.edu)

Back to the Department of Computer Science