By Soham Ghosh
Given a string and a shift value, in this project the string is encoded or decoded as per user's choice by the shift value, using Java.
The project executes in the following steps:
1. The user is asked to input whether he/she wants to encode or decode the string. Then the string and the shift value (represented by k) is input. BufferedReader class is used for user input. Also, the shift value is checked whether it is valid or not.
2. For encoding of string the shift value remains k, but for decoding, the shift value is changed to 26 - k.
3. The enitre string is traversed. Each letter is checked whether it is uppercase or lowercase, converted to its ASCII value and after getting modified by the shift value, is converted back to char type. The new letter is then appended to the result string.
4. Thus the original string is the encrypted/decrypted into the result string.
Submitted by Soham Ghosh (sohamghosh1509)
Download packets of source code on Coders Packet