Lecture 9 - February
6, 2007
Reminders and Information:
- Hold
on to your graded Lab 7 submissions and grade sheets.
- You
will work in the same teams and you will need both for a future lab
- Here's
a link to the
grade sheet discussed in class
-
- You
should print it out and go through it in detail with your Lab 5
implementation BEFORE submitting your programming assignment.
- See
Professor Harris tomorrow if you don't understand how to submit your
programming assignment which is due by Thursday night, February 8th at
midnight. The printout should be
brought to lab Monday, February 13th and put in the folder with
the required folder cover.
- Here's
a link to the required
folder cover
- Here
are links to the short example programs shown in class plus a few more.
Note that all have extension .txt so you need to rename them with the
extension .java to compile and run them.
- TryClose.java - shows that the exception that you
need to catch if you are using FileWriter and attempting to open a file
for writing is IOException.
- TryClose2.java - shows that the exception that
you need to catch if you are using PrintWriter and attempting to open a
file for writing is FileNotFoundException.
- TryOpen.java - shows that the exception that you
need to catch if you are using FileReader and attempting to open a file
for reading is FileNotFoundException
- TryException.java - shows that if you are
having your Scanner attempt to pick up an integer directly, the exception
that will occur if the value cannot be picked up as an integer is
InputMismatchException.
- TryException2.java - shows that if you are
having your Scanner pick up a String and using Integer.parseInt on the
String, the exception that will occur if the String can not be converted
to an integer is
NumberFormatException.
- TryLoop.java - shows that if you are using a loop
controlled by a Boolean variable (and you should be) to get a filename
from the user so you can open the
file, you don't need to change the value of the Boolean in the catch
block, you should change it in the try block if you succeed