In completing this assignment you MAY use/access the following resources:
You may NOT use/access:
- Resources not expressly listed above, including, but not limited to,
the following ...
- Source code not provided as part of this assignment. (Obviously, this
includes, but is not limited to, source code written by other students
whether current or in the past).
- Code-generating tools (of which ChatGPT is one example).
- Any web sites not directly linked to from the homework assignment.
Failure to abide by these guidelines will result in a zero for the assignment
and the incident will be reported to the university provost as a violation of
the university academic integrity policy. A second incident of academic
dishonesty (whether from this course or another computer science course) will
result in an F in the course.
NOTE: This assignment identifies what you need to do along with some guidelines,
but is quite a bit less prescriptive then previous assignments.
Do all of your work in the provided hw08 directory in your homework
respository.
Your final program should:
- Accept the name of a file as a command-line parameter. The input file
should be assumed to have a series of individual words with one word per
line.
- If there is no command-line parameter (or more than one) the program
should exit with an appropriate error message.
- For each word determine whether or not the word is a palindrome and
display these statistics when complete: total number of words read, total
number of palindromes, percentage of words that palindromes compose, the
amount of time elapsed to read the file and determine the required values.
Additional requirements:
- The timing of code should make use of a CodeTimer class. You can
write your own or use the one that appears in various examples.
- The reading of the data file should use a BufferedReader rather
than Scanner.
- Your solution should attempt an object-oriented design. NOTE: My design
used a single class in addition to main() and I passed the data file
name to the constructor as a parameter. I kept the method from the in-lab
assignment as a static method in my class.
- The code that houses main() should be in a file named
Driver.java.
- As always use JavaDoc notation for commenting classes and methods and
follow Java programming conventions.
For fun you might try to find a large text file that contains a bunch of words
(one per line) and see what the statistics look like.
As you work, document your code and commit at appropriate times. When
you complete your work be sure to push all committed changes to bitbucket.
In the data directory of the homework repository I provided a sample
input file named smallwords.txt. This is the output of my program
when run using that file as input:
+--------------------------------------------+
Input File : ../data/smallwords.txt
Words Processed: 13
# Palindromes : 4
% Palindromes : 30.769%
Time Elapsed : 0.000
+--------------------------------------------+
NOTE: When grading I will test your program using a different, much larger data file.
For this reason you should not use an array to store all the words.
The assignment will be graded according to the following criteria:
Correctness |
16 |
pts |
Documentation |
2 |
pts |
Conventions |
2 |
pts |
Version Control |
2 |
pts |
Total |
22 |
pts |
Your program should be completely working and should follow all of the
programming conventions named in class and explained in
http://josephus.hsutx.edu/classes/all/javaconventions/ (including the use
of comments that conform to the JavaDoc guidelines).
The instructor will grade your work based on what you have pushed to the hosted
homework repository you have shared. For all assignments the program is due
before the beginning of class on the due date. Repositories that show a commit
time after that time will be graded as late.