
CS 200, Fall 2010: Assignment 1
Review and Start on Programming Project

Due Tuesday 9/7/10 by 3 PM
The purpose of this assignment is to check how much you remember, or
can look up, from the pre-requisites of the class, to get you
started on the contents of this class and to gauge how well you
program for when we assign pairs. For those of you
who transferred in, this assignment is intended to make you quickly
get familiarized with our systems and our expectations. For those of
you who took CS161 here, it should make you dust off the cobwebs on
your programming knowledge...
Java Programming:
You are to write a program (whose class name is
prog1) that reads a text file, finds all the words in it
(removing punctuation as below), stores the unique words in
sorted order and prints out the stored words in order. It should also
remove any HTML commands.
- The program should take a file name as the argument. In
Eclipse, you can do this through the Run menu. Select run and then
write the filename in the program arguments box.
- A word is defined as a sequence of alphabetic or numerical characters bounded by whitespace or punctuation.
- You should store the words in an ArrayList.
- The words should be converted to lowercase and only one instance
of each word should be stored in the ArrayList. All punctuation except
' (as in the word "isn't") should be stripped out.
- Assume that HTML commands have the format
< chars >
Your code should discard all of the chars as well as the angle brackets.
- To keep the list sorted, you
should write a binary search method to figure out whether the word is
already stored and where to place the
word if it is not. This method should be separate from the main method.
- The program should collect the words from
the text file into
String objects.
- After the file has been read and processed, the program should
have an ArrayList of strings from the file.
-
You can use prog1Test.text
and
prog1Test.out
as an example for testing your program (input and expected output,
respectively). We will be testing your code
with other files as well, so do not simply test on this file.
- For output, the program should print the words found
in the text file in alphabetical order and the number of words that
were found in the format shown in the output example.
Notes:
- We expect programming assignments to be implemented in Eclipse.
We will be testing the code on the machines in the CS
computer lab, so make sure your code runs on those machines.
- See the Web page on how to electronically submit
assignments (this at the top of the Assignments page accessible from
the top of the CS200 Home Page.)
- Read the syllabus for the late policy.