// Complete this method so that it returns the encrypted character for
// theChar when and offset of theOffset is used
// So if theChar='m' and theOffset is 3 the method will return 'p'
// Lower case characters remain lower case, upper case remain upper case
// Any other characters are returned unchanged
char[]alphabet={'a','b','c','d','e','f','g','h','i','j','k','l','m','n','o','p','q','r','s','t','u','v','w','x','y','z'};// creates an array which has each letter of the alphabet
intletterPlace=0;//creates an int and the value is 0
theChar=Character.toLowerCase(theChar);//makes theChar equal to the lowercase value of theChar
booleanupperCase=Character.isUpperCase(theChar);// makes it equal to the uppercase value of theChar
if(Character.isLetter(theChar))
{
if(theOffset<0)
{
theOffset=theOffset+26;
}
if(theOffset>alphabet.length)// if the value of theOfset is greater than the length of the string alphabet
{
theOffset=theOffset-26;
}
else
{
theChar=alphabet[theOffset];
}
}
else
{
returntheChar;
}
for(inti=0;i<alphabet.length;i++)// creates a 'for' loop that runs as long as 'i' is less than the length of the array string alphabet
{
if(theChar==alphabet[i])
{
theOffset=theOffset+i;
}
}
if(upperCase)
{
theChar=Character.toUpperCase(theChar);//makes thechar equal to the uppercase value of thechar
// Complete this method so that it uses encryptedCharacter to
// return the encrypted version of theMessage using theOffset
Stringoutput="";
for(charletter:theMessage.toCharArray())//creates a 'for' loop that iterates the char "letter" through theMessage.tochararray
{
output=output+letter;
letter=enryptedCharacter(letter,theOffset);// makes letter equal to the amount which has been obtained while running theMessgae through the encrypted character method above