Specifically, you will write a Java program that reads and stores the count of the number of uses of each letter in three books: Green Eggs and Ham by Dr Seuss; Pride and Prejudice by Jane Austen and Rob Roy by Sir Walter Scott. The full text of the books is available on Unix at:
/home/gtowell/Public/CS113/HW5/ham.txt
/home/gtowell/Public/CS113/HW5/PP.txt
/home/gtowell/Public/CS113/HW5/RobRoy.txt
The file ham.txt is identical to the one used in HW4.
You can almost exactly re-use code from the previous assignment for reading and storing character counts. The only adjustment you need is that the text of Pride and Prejudice and Rob Roy both contain a few non-ASCII characters. Hence, instead of lines like:
// fileReader is my FileReader and counts is an array of int
int c = fileReader.read();
counts[c]++;
in your reading of the file you will need
int c = fileReader.read();
if (c<128)
counts[c]++;
Now that you have the data collected do the following, for each file (ie. 0..3 in your 2-D array):
ham.txt
total characters read: 3457
letters read: 2438
most common letter: 'e' with count of 276
'e' as percentage of letters: 7.983800983511715
My stat is XXXXXXX which has a value of YYYYY
where XXXXXXX is a brief description of your statistic and YYYYY is the value of your statistic.
Requirements:
Before submitting you should have at least 2 files in your HW5 directory: ZZZZZ.java, and Readme. (You might also have .class files and .txt files.)
cd
cd CS113
mkdir HW5
Once you have made the HW5 directory in Unix, open a terminal on you own computer and in that terminal use "cd" to navigate to the directory containing your work for this assignment. Assuming you use the same directory structure on your own computer and in the lab, this process can be accomplished with the following commands
cd
cd CS113
cd HW5
Then use the scp command to copy each of the files you want to submit from your computer to the lab. For example:
scp Readme UNIX_NAME@goldengate.cs.brynmawr.edu:CS113/HW5/Readme
As always, when you read "UNIX_NAME" put in your UNIX user name. Also, with each scp command you will need to enter your UNIX password.
cd
cd CS113
/home/gtowell/bin/submit -c 113 -d HW5 -p 5
In response to the submit command you should see a series of messages ending with:
Submitting archive...
Submission complete! Submission timestamp is 2023-08-08-15-30-28-EDT.