CS 178 Programming with Multimedia Objects
Fall 2004 |
||||||||||
Recitation Exercise:
Prepared by: Aditya Mathur. To be completed in class on Oct 29, 2004. |
||||||||||
Learning objectives:
|
||||||||||
Complete the following set of instructions to develop a few simple methods. Be careful about where in the program you declare a variable. The try creates a block and so does catch. Any variables declared inside the try and catch blocks are local to their respective blocks.
Global Array and other declarations:
Write the following two methods. public DataInputStream fileOpen(String fileName)
public void readAndDisplayGenes(DataInputStream inStream)
As an example, suppose that the file genes contains the following data: 2 9 cleaopatra 5 tudorYour method should read two gene names in the file and display them in two text fields. As another example, the following file should lead to an exception while reading data: 2 9 cleaopat 5 tudor Last update: October 29, 2004 |
||||||||||
Solution (source)
This solution is an applet and contains several methods that you were not asked to write during the recitation. This will work as desired only if compiled and executed on the same computer. |
||||||||||