summaryrefslogtreecommitdiff
path: root/readme.txt
blob: af07ce411676269c4b767e505b71bd4579bd9ca8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
Word Count Program
Joe Robinson
Java Test for Ensemble

This program can be used to count the number of occurences of a word in a given file.

It will not count words which are used again as part of longer words.

E.g: "his" and "is" will not be counted if "this" is used.

To run the program, run:

java -jar WordCount.jar

This will prompt you for a text file to count the words from. You can enter just the filename if it is in the same directory as WordCount.jar, or provide a full path to a file.

You can also enter the filename as an argument, e.g:

java -jar WordCount.jar test.txt

Source code is located in src/com/ensemble/wordcount

The file can be compiled and built with the following commands:

javac -d classes src/com/ensemble/wordcount/*.java

jar cvfm WordCount.jar manifest.txt classes/com/ensemble/wordcount/*.class

Two example files are provided

test.txt - the example line provided in the specification. The program will produce the same output as given in the specification.

specification.txt - The specification for the program as provided by email. 

Known issue: Currently all punctuation is removed, as otherwise it was counting words with punctuation following them as a different word (e.g "maybe." would discard "maybe". This is not ideal as it would also remove punctuation in the middle of the words, and we probably only want to remove punctuation at the start/end of words. I considered this to be outside of the specification, as it would take some extra time to ensure this was handled properly, and it was not specified how or if this 
should be handled.

Note: This has been tested on Linux and Windows systems, but should work on any system which can run Java.