Question: Problem Description : The text presented Huffman tree and you learned how to create a Huffman tree and how to encode a text using a
Problem Description : The text presented Huffman tree and you learned how to create a Huffman tree and how to encode a text using a Huffman tree. Create a new Java project in your workspace called HuffmanCode where is LastName replaced by your last name and studentID is your student ID
Develop a class called HuffmanCode that compresses and decompresses text files. Specifically, the program should ask the user if they would like to compress a file or decompress a file The argument should be passes from commandline arguments. The first argument is the name of the file to be compressed or decompressed; the second argument is the name of the file where the output goes. For example, consider the following command compress a source file into a target file:
java BonusAssignmnet
The preceding command compresses the file. The following command decompresses a source file into a target file.
java BonusAssignmnet
When compressing a file, the input files should simply be plain old humanreadable text files. The output file, on the other hand, will not be humanreadable. If opened in an editor, the compressed file will appear as unintelligible bytes representing the compressed text from the input file. The compression program will also create a statistics file. The statistics file will contain the compression information needed to decompress the message in a compressed file. For obvious reasons, this information will not be compressed. It should, however, be represented concisely... the point of compressing a file, is to reduce the amount of information to be stored. You can use any of the data structures included in the Java Collections framework. In other words, you can use the Java library versions of HashMap, Set, etc. You may also find it useful to create other classes in addition to the HuffmanCode class. For example, a TreeNode class might be useful when creating a Huffman tree to determine the bit sequences for each character.
The statistics file eg statistics.txt will contain information about each different character in the input file. Specifically, the file should include the character, the number of occurrences of that character in the input file, and its binary Huffman code representation in human readable form For example:
A
Once the program is completed, you need to compressdecompress the The Cat in the Hat by Dr Seuss.txt file for testing purpose. The file has been uploaded along with the assignment.
The Cat in the Hat by Dr Seuss.
The sun did not shine.
It was too wet to play.
So we sat in the house
All that cold, cold, wet day.
And then
Something went BUMP!
How that bump made us jump!
We looked!
Then we saw him step in on the mat!
We looked!
And we saw him!
The Cat in the Hat!
And he said to us
"Why do you sit there like that?
I know it is wet
And the sun is not sunny.
But we can have
Lots of fun that is funny!
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
