Assignment #1

due: Tuesday, October 15

This program will read words from a file. These words will be stored in a partially filled array. When you declare the partially filled array, create only 10 elements in the array. After all the words are read in, print all the words in the order they were read in, one word per line. The input file may contain many words per line (use StringTokenizer to separate the words). The only non-letters you should allow in a word are the dash (-) and the apostrophe ('). Pass the file name to the program using command line arguments. If the file does not exist give an appropriate error message and terminate the program (The program should not crash.).

Example:

If your input file was called a1.in and your program was called A1.java then the command from a command line would be:
java A1 a1.in

If the input file was:
This is the first line of the input file.  It has
more than one line!
It should produce the following output:
This
is
the
first
line
of
the
input
file
It
has
more
than
one
line

If there are not the correct number of command line arguments (exactly one) then the program should simply print an error message and terminate (but not crash).

Marking Scheme

____
 21
 
reads from a file                      (2) _____
uses partially filled array            (2) _____
file name from command line arguments  (2) _____
uses string tokenizer efficiently      (3) _____
correct error messages                 (2) _____
correct output                         (4) _____
opening comment                        (1) _____
comment includes:  name __, period ___, purpose __
                   assignment # __, date ___       (1) _____
variable dictionary                    (2) _____
indentation                            (2) _____