Java

INDEPENDENT TOPIC 06 – CHARACTERS

 

LESSON WORK

 

 

QUESTION 1 - PRACTICE


Write a program that asks the user for two characters.  You can either look up how to get a character, or you can get a String and use charAt to get the character from that String.

 

Then, output the characters in alphabetical order.

 

QUESTION 2 – CEASAR CIPHER

 

Ask the user to enter a 5-letter word.  Read it in as a String.

 

Then ask the user to enter a value shiftAmount that needs to be between -5 and 5. 

 

You need to shift each character in the word by shiftAmount.

 

Then you need to output the encoded word.

 

Bonus: Can you make it so that shifting wraps around letters only?  For example, if the letter ‘y’ is shifted by 2, it should become ‘a’.