CS 200, Fall 2014: Assignment 1
Introduction, Review and Start on Project
Due Wednesday 9/10/14 by 12:00 PM
The purpose of this assignment is to get oriented, to check how much you remember, or
can look up, from the pre-requisites of the class and to get you
started on the contents of this class. For those of you
who transferred in, this assignment is intended to help 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...
Introduction: [10 pts]
Your instructors (professor and teaching assistants) would like to get
to know you a bit. So we are requesting two ways for you to do so:
- Put your name in large, friendly, readable letters on the card
stock that we will give you. You can add any picture to it that you
think characterizes you and/or your interests. Bring it to class
each session and place it in front of you facing the
instructor. Note: having this will help contribute toward your
participation grade.
- To encourage everyone to participate on the discussion board,
you need to introduce yourself to the rest of the class. You must
log on to RamCT and add to the Introductions discussion
thread. Provide your name and at least one other 'byte' of
information: why you are taking the course, what your passion is,
the most unusual thing you have ever done, a photo of your
dog…whatever.
Java Programming: [90 pts]
You are to write a program (whose class name is
P1) 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. [Note: this means
that numbers are considered to be words.]
- 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.
- We will be using the automated testing/grading system for
submission and testing of your programs. To get you started in your development,
you can use input1
and
output1
as an example for testing your program (input and expected output,
respectively). However, we will be testing and grading 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 unique words that
were found.
- Do think hard about what errors might occur. Error messages should be proceeded by Error:
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.)
- To submit this assignment, create a jar of only the source code files and name it "P1".
- Read the syllabus for the late policy.