• Dialog Boxes
    • Example of asking user to enter input, and to confirm (yes/no/cancel): EvenOdd.java
    • To display a dialog with a list of choices in a drop-down list box
      • You may modify the array of choices to include the choices you want, e.g. String[] choices = { "check balance", "deposit", "withdraw", "quit" };
    • First attempt (do not use this one) of trying to write a flexible IOHandler class that allows ease of modification between 2 modes of IO (standard IO and dialog boxes).
    • Better design: an interface implemented by multiple concrete classes...
      • Interface: IOHandlerInterface.java
      • concrete class 1:IOHandlerStandard.java
      • concrete class 2:IOHandlerDialog.java
      • a Driver class that uses the above: Driver.java
  • File I/O
    • URLDissector.java uses urls.txt as an input file.
    • Example of reading from a file into an array of objects:
      • Library.java is a driver class that uses Book.java and input file books.txt
      • Store Library.java, Book.java and books.txt in the same project folder, then run the test method of Library, which reads book info from the input file (books.txt) into bookArray (an array of Book objects) then prints all the books in the array.
    • Example of writing text to a file (using predefined classes and methods in the java.io package): copyTextFile.txt (Note the statements that declare, initialize and use variable ofStream).
    • A program that opens a file and reads one line into an object: Transactions is a driver class which uses InputManager and Account