CMIS 241 Week 1 Read Chapter 1 this week. It's got the phases of the software lifecycle: specification, design, testing. It's what's done for large, real software projects in the real world. The textbook is tedious, very complicated, and re-implements what already exists in Java, so you will never use the book's code or your own implementations of these data structures outside of this course, oops, not supposed to say anything negative about the textbook. The book is three in one: data structures, OOP techniques, and GUI. Some of you could do all this but I can't handle all three at once... This course had a high dropout rate when it consisted only of data structures. While all the material is useful, some is more useful than others, especially for this course and the level that you're at and the programs you'll write for this class. So concentrate on the following: Object-oriented design p. 14-22 We'll use the Date classes. p. 50-59 Exercises 16 and 24 (not to be turned in) ************************************************************ Download and install the book's example programs. Use the link on the class web site: http://sensei.ad.umuc.edu/dwills/cmis241/textbook.zip Rename the 0763710792 folder to bookFiles, as that is what the book calls it. ************************************************************ Our first programming fun: In folder ch01, in IncDate.java comment out line 1: //package IncDate; in TDIncDate.java comment out line 11: //import IncDate.*; then compile it. The Date and IncDate files will be compiled automatically. Many of the book's programs use file I/O (this was state of art computing during the Johnson administration, before there was newfangled equipment like keyboards and monitors). Of course there is a need for file I/O (e.g. whenever data, especially large amounts of it, needs to be stored and retreived) so it's good to see how it's done in Java. Pages 55,56 have details. In my examples, any variable starting with "my" means my dummy example variable. //incantation to setup to input from a named file: BufferedReader myDataFile = new BufferedReader(new FileReader(myDataFileName)); //read next line from file, assign to String: myString = myDataFile.readLine(); //incantation to setup to output to a named file: PrintWriter myOutFile = new PrintWriter(new FileWriter(myOutFileName)); //write a string to the file: myOutFile.println("my whatever " + myDummy); Pages 55,56 have details. There are other ways to read/write files of primitive types and of objects. The book's programs use command line arguments to get the names of the input and output files. Page 54 explains that. Here's how to setup command line arguments in JCreator: 1. Select Configure > Options. 2. Select JDK Tools. 3. Select Run Application from the Select Tooltip list. 4. Select in the list. 5. Click Edit. 6. On the Parameters tab of Tool Configurations dialog box, click the Prompt for Main Method Arguments checkbox. 7. OK. OK. 8. When Execute, a window pops up for the command line arguments to be typed. (will do so for every program executed). Now you will be able to run the TDIncDate program. ************************************************************ While file I/O is occasionally useful and necessary, usually it's not. So I've made another version of this program called TDIncDate241.java on the class web site. It uses JOptionPane for input and outputs to the "DOS box". For those who've never used JOptionPane for input or output, look at: http://sensei.ad.umuc.edu/dwills/cmis141/Dialog.java and then the first half of: http://sensei.ad.umuc.edu/dwills/cmis141/ScrollPane.java for a brief demo. Put TDIncDate241.java in the ch01 folder and it should compile.