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.
Habit 3: Put First Things First 1. What one thing could you do (that you aren’t...
Habit 3: Put First Things First 1. What one thing could you do (that you aren’t doing now),   that if you did on a regular basis, would make a tremendous in your life? 2. What one thing in your business or professional life would bring similar results?
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...
1. Is social media a good thing or a bad thing? 2. Do you think that...
1. Is social media a good thing or a bad thing? 2. Do you think that social media, instead of connecting us together, cut us off from other people?
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...
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT