Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Develop java program to read a line of text, and an integer number between 1 and 10 as a cipher key from keyboard, and cipher

Develop java program to read a line of text, and an integer number between 1 and 10 as a cipher key from keyboard, and cipher the text. cipher each character and digit based on the following rules: 1. Modify each Uppercase letter by adding cipher key to its Unicode. If the added value falls beyond the range of the upper case letters (larger than symbol 'Z'), then circulate it by staring from letter 'A'. For example if cipher key is equal to 5, then A will change to F, B will change to G, ..., U will change to Z, V to A, W to B, and ... A-> F, B-> G, C-> H, ..., V-> A, W->B, X-> C, Y->D, Z->E 2. The same process applies to lower case letters, a-z, and digits, 0-9. 3. Do not apply ciphering to other symbols. 4. Find the binary representation of each ciphered symbol using 8 bits for each symbol, and display it on the screen. For example, if input message is AB C, and cipher key is equal to 4 then the output would be: 01000101010001100010000001000111 that stands for binary representation of EF G Note that there is a space between B and C, and we did not ciphered it, but we show the binary representation of space in the output. More examples: message : This is a test . key = 5 coded message (not displayed): Ymnx nx f yjxy. Output: 01011001011011010110111001111000001000000110111001111000001000000110011000100000011 110010110101001111000011110010010000000101110 message : cpsc1150 ? Is my course! key = 8 coded message (not displayed): kxak9938 ?qa ug kwczam! Output: 01101011011110000110000101101011001110010011100100110011001110000010000000111111001 00000001000000111000101100001001000000111010101100111001000000110101101110111011000 1101111010011000010110110100100001 You need to develop following method in your program: public static String ascii2binary(int n){ String binary=""; // develop your code }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Students also viewed these Programming questions