Additional hints for homework 0 in Windows and DOS
Initial questions from the students reveal more problems working with plain text files in DOS and Windows than I thought possible. These instructions go through the steps needed to take a program NpvA.java, copy it to NpvA1.java, and compile and debug the new program.
Here is how you would go about making and testing the changes. I am assuming you are working in the subdirectory U:\dybvigs\compufin and that is where NpvA.java and NpvA.html are to be found. (It turns out it is easiest to use a simple directory name like compufin rather than something like 'Java Programs' that has spaces in it, for the cd command.) To be safe, download a new copy of these files (using your Refresh or Reload button); I have put up versions that are formatted slightly differently to accomodate the peculiarities of notepad. Enter an ms-dos window (using the ms-dos icon or by using run and typing "command"). Once in the DOS window, here are the steps I recommend.
U: (go to the C: drive, needed if you are not already there) cd \dybvigs\compufin (change directory to \dybvigs\compufin. For some directory names, this may be a problem -- see the problems and fixes page) dir (directory listing. makes sure you are where you think you are and that NpvA.java and NpvA.html are present and have the right names. If IE scrambles the file names, as it likes to do, you can fix them using the rename command. For example, 'rename NpvA.java.htm NpvA.java') type NpvA.html (types out the file; it should look like the one in the problem set. if it is longer and has other nonsense, perhaps Internet Explorer has edited it when you saved it. In Internet Explorer, try using ``save as'' and ``html only'') javac NpvA.java (this creates the class file NpvA.class for the original program) appletviewer NpvA.html (this looks at the original applet. exit appletviewer when you are done looking at it) copy NpvA.java NpvA1.java (this creates a copy to work with. you will want to rename the class from NpvA to NpvA1 and make the corresponding change in the html file) notepad NpvA1.java (this is how you edit the file. of course, you can enter notepad in windows instead. save and exit when the changes are done. Potential problem: notepad does not handle all standard text files well. If the file has all lines combined into one strange long line, let me know; perhaps there is a fix I can perform on the web-page copy) javac NpvA1.java (compiling the new applet. as necessary, re-edit NpvA1.java try again until the compilation works) copy NpvA.html NpvA1.html (this makes a copy of the html file) notepad NpvA1.html (editing the html file. you will need to change the name of the class file from NpvA.class to NpvA1.class. You may also want to change the height and width in pixels. appletviewer NpvA1.html (testing the new applet)