Commit e2bbc9f0 authored by Bran's avatar Bran

completion

parent d9c9720f
......@@ -71,75 +71,32 @@ public class AssessmentPartThree {
j = (char) (theMessage.charAt(i) + theOffset); // makes j a char equal to the i'th value of theMessage + the value of the offset
}
if ((Character.isLowerCase(theMessage.charAt(i))) && j > 'z')
if ((Character.isLowerCase(theMessage.charAt(i))) && j > 'z') // if the i'th character of theMessage is lowercase and the value stored in j is greater than the lowercase value of z
{
j = (char) (theMessage.charAt(i) - (theOffset - 26));
j = (char) (theMessage.charAt(i) - (theOffset - 26)); // makes j equal to the value of i'th character of themessage minus the value of theoffset minus 26
}
if (Character.isUpperCase(theMessage.charAt(i)) && j > 'Z')
if (Character.isUpperCase(theMessage.charAt(i)) && j > 'Z') // if the i'th character of theMessage is uppercasecase and the value stored in j is greater than the uppercase value of z
{
j = (char) (theMessage.charAt(i) - (theOffset - 26));
j = (char) (theMessage.charAt(i) - (theOffset - 26)); //makes j equal to the i'th character of themessage minus the value of theOffset, minus 26
}
if (Character.isUpperCase(theMessage.charAt(i)) && j < 'A')
if (Character.isUpperCase(theMessage.charAt(i)) && j < 'A') // if the i'th character of theMessage is uppercasecase and the value stored in j is less than the uppercase value of A
{
j = (char) (theMessage.charAt(i) + (theOffset + 26));
j = (char) (theMessage.charAt(i) + (theOffset + 26)); // makes j equal to the i'th character of themessage plus the value of the offset plus 26
}
if ((Character.isLowerCase(theMessage.charAt(i)) && j < 'a'))
if ((Character.isLowerCase(theMessage.charAt(i)) && j < 'a')) // if the i'th character of theMessage is lowercase and the value stored in j is less than the lowercase value of a
{
j = (char) (theMessage.charAt(i) + (theOffset + 26));
j = (char) (theMessage.charAt(i) + (theOffset + 26)); // makes j equal to the i'th character of themessage plus the value of the offset plus 26
}
string.append (j);
string.append (j); // returns string with the value of j added too it
}
return string.toString(); // returns a string containing whatever is stored in the stringbuilder "string"
}
/* char[] buffer = theMessage.toCharArray();
for (int i = 0; i < buffer.length; i++)
{
char letter = buffer[i];
letter = (char) (letter + theOffset);
if (('z' < letter) && ('Z' < letter))
{
letter = (char) (letter - 26);
}
else if (('a'< letter) && ('A' < letter))
{
letter = (char) (letter + 26);
}
else
{
letter = (char) (letter);
}
buffer[i] = letter;
}
return new String(buffer);
}
*/
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment