Implemented encoder and demux

Implemented Encoder and Demultiplexer class code for Review. Please note  I have implemented the logic of encoder and demux for review. Based on your reviews, I will correct the code.