Tim Ward 1/22/07 Lab 4 Section 3 Lab: Experimenting with Input/Output 3.3. What was the first error generated by the compiler? Rooter.java:23: cannot find symbol symbol : class PrintWriter location: class Rooter PrintWriter screen; 3.4. What line did you need to add? import java.io.PrintWriter; in order to be able to use the PrintWriter class 3.6. What was the first error generated by the compiler this time? Rooter.java:24: cannot find symbol symbol : class Scanner location: class Rooter Scanner keyboard; ^ 3.7. Fix this error. What line did you need to add? import java.util.Scanner; in order to be able to use the Scanner class 4.4. Why was no output generated? The buffer is not being flushed. 4.5. Fix this mistake. What line did you add? screen.println("Enter a number: "); screen.flush(); In order to flush the buffer after the program asks for input. 4.6. What do you need to type in the terminal window (as a response to the prompt) in order to make this application terminate normally? Ctrl-Z 5.4. What output was generated? Today's Date: 22 January 2007 Birthday: Sir Francis Bacon Birthday: George Foreman 5.6. What happened and why? The program crashed because there is no file named anniversarys.txt in the working directory. 5.8 What changes did you need to make? I had to declare dates as a File. 5.10. What changes did you need to make? if ( args.length == 1) { dates = new File(args[0]); } I had to test for a filename passed to the program and if there is one passed, then dates becomes that file. 5.12. What changes did you need to make? I needed to test of dates was instantiated, and if so then dateScanner takes dates as a parameter instead of System.in. In addition to that, I needed to add "throws FileNotFoundException" so that I tell the compiler I know that an exception may occur. 5.14. What output was generated? Today's Date: 22 January 2007 Birthday: Sir Francis Bacon Birthday: George Foreman 6.2. What changes did you need to make? I needed to add a for loop to traverse the args array in order to take care of multiple arguments passed through the command line. 6.4. What output was generated? Today's Date: 22 January 2007 Birthday: Sir Francis Bacon Birthday: George Foreman Programming Assignment 1 Due Review the Java tutorial on Exceptions