程序代写代做代考 Design Encoding

Design Encoding
Table1 Character to Morse code
in function getMorseCode
stores the morse codes as array of string. Convert char to int, then return the morse codes in the corresponding position in the array.
Table2 Morse code to Character
View as Morse code as number in base 3. For example *** as 0 and XX- as 25.
return the character in keyword array.
Encoding process
1. convert key and origin text to upper case
2. remove duplicate character from key and add remaining character to form key phrase.
3. shift key phrase
4. convert every character in origin text to morse code, add X between character and XX between word.
5. partition morse codes to groups, every 3 character as a group, loop up table2
to form final encoded string.
Decoding
Table1 Morse code to Character
Search the morse code array, find the position. For example -** in position 1, so ¡®A¡¯ + 1 = ¡®B¡¯ is the corresponding character.
Table2 Character to Morse code
First , get the character position, then convert the position number to number in base3, ¡®*¡¯ is 0, ¡®-¡® is 1 and ¡®X¡¯ is 2. For example suppose A is in position 2, convert 2 to base 3 is 002, so it is **X.
Decoding process
1. convert key and encode text to upper case

2. 3. 4.
5.
remove duplicate character from key and add remaining character to form key phrase. shift key phrase
convert every character in encode text to morse code using table2
convert morse code to character using table1