Question

In: Computer Science

Step 1: The first thing you should do is modify the case conversion program that Neil...

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.

Solutions

Expert Solution

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);

                
        }

}

Related Solutions

Writing a caesar cipher in ARM assembly. INSTRUCTIONS: Step 1: The first thing you should do...
Writing a caesar cipher in ARM assembly. INSTRUCTIONS: Step 1: The first thing you should do is modify the case conversion program String.s (provided) 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 to...
What is the FIRST thing you should do when you speak to this community about the...
What is the FIRST thing you should do when you speak to this community about the risk from the PFAS contamination? (select one option only) Discuss sources of scientific uncertainty Compare the magnitude of this risk to other risks Express empathy and understanding Present and explain the results of testing
You will decide the moral thing to do in this medical case. In this forum, you...
You will decide the moral thing to do in this medical case. In this forum, you just share your plan with your peers as a way to practice for the final test. Pay attention and take notes on how they approach this case using the three major ethical theories you have already learned in this class, as you will be asked to apply only ONE in the final exam essay question.
Neil De Grasse Tyson said, "The good thing about science is that it works whether you...
Neil De Grasse Tyson said, "The good thing about science is that it works whether you believe in it or not." Describe two aspects of science and the scientific method that support this statement.
In the first by-pass step of gluconeogenesis, the conversion of pyruvate to phosphoenolpyruvate, pyruvate is carboxylated...
In the first by-pass step of gluconeogenesis, the conversion of pyruvate to phosphoenolpyruvate, pyruvate is carboxylated by pyruvate carboxylase to oxaloacetate, which is subsequently decarboxylated by PEP carboxykinase to yield phosphoenolpyruvate. Explain using thermodynamic terms why this by-pass step is necessary. Why couldn't the glycolytic enzyme responsible for interconverting phosphoenolpyruvate and pyruvate also participate in the gluconeogenesis pathway?
Your program should be in a new project named "Program 3: Number System Conversion" and should...
Your program should be in a new project named "Program 3: Number System Conversion" and should be in a package named "numberSystem". Your program must be in a file called "Program3NumberConversion.java". Your goal is to convert a number in some other number system (such as binary) to decimal. The base (also known as a radix) will have a maximum of 16. Before beginning your main method, write two other methods: public static int parseNumber (char letter) will basically be a...
1. What should you do if a person changes their end-of-life requests? Create a step-by-step outline...
1. What should you do if a person changes their end-of-life requests? Create a step-by-step outline of what you should do that could be used to train other care workers. 2. When a person who is accessing services informs you that they wish to die at home, what action should you take? 3. What are three things that you should document when a person is reporting that they have pain? 4. Research one of the pain management/comfort promotion techniques mentioned...
Modify the Assignment program from Module 1 to read a user's first and last name read...
Modify the Assignment program from Module 1 to read a user's first and last name read three integer scores, calculate the total and average determine the letter grade based on the following criteria - Average 90-100 grade is A, 80-89.99 grade is B, 70-79.99 grade is C, all others F (use a nested if) Output formatted results consisting of the full name, the three scores, the total, average (to 2 decimal places), and the letter grade go to step 1...
PYTHON Modify the program in section Ask the user for a first name and a last...
PYTHON Modify the program in section Ask the user for a first name and a last name of several people.  Use a loop to ask for user input of each person’s first and last names  Each time through the loop, use a dictionary to store the first and last names of that person  Add that dictionary to a list to create a master list of the names  Example dictionary: aDict = { "fname":"Douglas", "name":"Lee" } ...
You should write a small C++ program that performs the following tasks: First, your program should...
You should write a small C++ program that performs the following tasks: First, your program should read in a set of 5 integers from “standard in” (remember cin). The numbers that you read in will be either zero or positive. If at least one of the five numbers entered is non-zero then your program should calculate the sum of the numbers and report that back to the user using “standard output” (remember cout). Then your program should be ready to...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT