Objectives:
| Assignment: Write a class Code which has two static methods encode and decode. Both these methods take two file names as parameters, a source file and a target file. You should read text from the source file and in the encode method every character is changed by adding one to the character code. You should write the encoded text to the target file. The decode method reads the encoded text and decodes it back to plain text by reversing the process. You may find the String method toCharArray useful to convert a String to an array of characters. To convert an array of characters to a String use the static method String.copyValueOf. To do the encoding
you can cast a char to an int, add 1, and cast back to a char. |