Question: Write a program according to the specifications found below, that: Compresses a text file into a Huffman-encoded file, generating the symbol frequency file for

Write a program according to the specifications found below, that:

• Compresses a text file into a Huffman-encoded file, generating the symbol frequency file for that particular text file

• Decodes a Huffman-encoded file into a text file, using the symbol frequency file for that particular file .

I need help to write the following class.

Class EncodingData.java:

This class is for you to write and represents a single pair of the data used to encode a text message into its binary Huffman code (a symbol and its corresponding binary Huffman code). It will be used for encoding a text file. Your implementation of the Encoding Data class must include the following, with the method headers as specified:
Attributes:

Private char symbol: a symbol that is to be encoded private String encoding: the binary Huffman code of the symbol (i.e. a string of 0’s and 1’s) Constructor: public Encoding Data(char symbol, String encoding) Public methods:

• Get Symbol(), get Encoding(), set Encoding(): getter and setter methods for both attributes

• Public boolean equals(Object obj): method that determines if two EncodingData objects are equal based on the symbol attribute (implement it in the same fashion as the equals(Object obj) in the class HuffmanPair)

• Public String toString(): method that gives a string representation of the symbol and its Huffman code

Step by Step Solution

3.34 Rating (157 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

To tackle this problem lets design the EncodingData class stepbystep according to your specifications This class will encapsulate a symbol and its cor... View full answer

blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!

Related Book