In: Computer Science
Step 1: The first thing you should do is modify the case conversion program that Neil did in class. Instead of subtracting 32 from all numbers you want to add a constant number which we will call the key. Assume that all input will be lowercase. So it'll look like this, k = 2; letter = 'a'; newletter = k+letter; Above is pseudocode and ABOVE NOT ASSEMBLY CODE DO NOT COPY. Use bl puts the same way Neil did in class to show that everything is working correctly. You should hard code the plaintext in the assembly file. Step 2: If the key + letter is bigger is 'z' then you have to subtract 26. If the key + letter is less than 'a' then you have to add 26.
Dear Student,
I tried to understand your question and implemented the code .
As the language wasn't mentioned i coded it in Java
You can manually change the letter and key according to your preference.
the answer is printed in both numeric and character values
public class CaseConversion {
public static void main(String[] String) {
int letter = 'z';
int key = 10;
int newletter = key + letter;
if(newletter>'z') {
newletter=newletter-26;
}
else if (newletter<'a') {
newletter =
newletter + 26;
}
System.out.println(newletter);
System.out.println((char)
newletter);
}
}
public class CaseConversion {
public static void main(String[] String) {
int letter = 'z';
int key = 10;
int newletter = key + letter;
if(newletter>'z') {
newletter=newletter-26;
}
else if (newletter<'a') {
newletter = newletter + 26;
}
System.out.println(newletter);
System.out.println((char) newletter);
}
}