Commit 47ea73f5 authored by ash.brett's avatar ash.brett

Update AssessmentPartThree.java

parent 1f767dd2
......@@ -67,26 +67,19 @@ public class AssessmentPartThree {
//This section of the code creates a new instance of StringBuilder called encoded
StringBuilder encoded = new StringBuilder();
//The section of the code creates the int i and sets its value to 0. And then says for each time i is less than the length of the String theMessage run the code below and increment i by one
for (int i=0; i < theMessage.length(); i++) {
//this creates a char called letter and sets it to be equal to theMessage character at i
//i is used to work out the char of the message
//for example if the value of i is 2 then it will look for the character at 2 in the message
char letter = theMessage.charAt(i);
//This creates a new char called result and sets it to be equal to the result of the method enryptedCharacter
//This section of code takes in the char letter and theOffset in order to run the method enryptedCharacter using these values
//this section of the code states that for each time letter within the character array it should run the code below
for (char letter : theMessage.toCharArray()) {
//This section of code takes in the char letter and theOffset in order to run the method enryptedCharacter using these values
char Result = this.enryptedCharacter(letter, theOffset);
//This section of code takes in the char Result and adds it to the StringBuilder encoded
//This section of code takes in the char Result and adds it to the stringBuilder encoded
encoded.append(Result);
}
//This section of the code returns the value of the StringBuilder encoded in a string
return encoded.toString();
//This section of the code returns the value of the stringBuilder encoded in a string
return encoded.toString();
}
}
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