@@ -21,92 +22,117 @@ public class AssessmentPartThree {
// Any other characters are returned unchanged
Stringlowerbet="abcdefghijklmnopqrstuvwxyz";
Stringcapitalbet="ABCDEFGHIJKLMNOPQRSTUVWXYZ";
for(inti=0;i<lowerbet.length();i++)
Stringlowerbet="abcdefghijklmnopqrstuvwxyz";//creates a string containing all the letter of the alphabet in lowercase
Stringcapitalbet="ABCDEFGHIJKLMNOPQRSTUVWXYZ";// creates a string containing all the letters of the alphabet in uppercase
for(inti=0;i<lowerbet.length();i++)// creates a for loop that declares a variable called I, then iterates until i is greater than the length of the string lowerbet (in this case it would be 26)
{
if(theChar==lowerbet.charAt(i));
if(theChar==lowerbet.charAt(i))// creates an if statement that triggers if the character in theChar is equal to the ith value of the string lowerbet
{
charnewnumber=lowerbet.charAt(theOffset+i);
returnnewnumber;
charnewnumber=lowerbet.charAt(theOffset+i);// assigns character equal to the character at the value of offset + the value of I of the string lowerbet to a char called newnum
returnnewnumber;// returns the value of newnum
}
if(theChar==capitalbet.charAt(i))
if(theChar==capitalbet.charAt(i))// if the value of theChar is equal to the i'th character of the string capitalbet
{
charnewnumber=capitalbet.charAt(theOffset+i);// assigns character equal to the character at the value of offset + the value of i
charnewnum=lowerbet.charAt(theOffset+i);
returnnewnumber;//returns the value of newnum
}
returnnewnum;
}
charnewnumber=theChar;// assigns the value of theChar to newnum