Data Structures and Algorithms in Java
6th Edition
ISBN: 9781118771334
Author: Michael T. Goodrich
Publisher: WILEY
expand_more
expand_more
format_list_bulleted
Textbook Question
Chapter 3, Problem 39P
Write a
Expert Solution & Answer
Trending nowThis is a popular solution!
Students have asked these similar questions
Encrypt
Caesar cipher is a kind of substitution cipher. Instead of using a substitution table, the alphabets are rotated by a number (a key). For example, if the key is 3, plaintext alphabet a would become d, and plaintext alphabet z would become c.
Write a program that implements the Caesar Cipher. You program will first prompt for the key and then for the mode (E for encryption and D for decryption) and finally for the message to be encrypted / decrypted. Your program will then output the encryption / decryption message.
For this question, the input message may consists of any character, the program should encrypt or small letter case a to z only. All other characters should be kept intact after encryption or decryption.
Python
The Dan Cipher works like this: shift the first lowercase character to the right by 1, the second lowercase character to the right by 2, and so on. Characters that are not lowercase characters are not changed.
Write a program that takes a string and prints the result of applying the Dan Cipher.
A simple and very old method of sending secret messages is the substitution cipher.
You might have used this cipher with your friends when you were a kid.
Basically, each letter of the alphabet gets replaced by another letter of the alphabet.
For example, every 'a' get replaced with an 'X', and every 'b' gets replaced with a 'Z', etc.
Write a program thats ask a user to enter a secret message.
Encrypt this message using the substitution cipher and display the encrypted message.
Then decryped the encrypted message back to the original message.
You may use the 2 strings below for your subsitition.
For example, to encrypt you can replace the character at position n in alphabet
with the character at position n in key.
To decrypt you can replace the character at position n in key
with the character at position n in alphabet.
Have fun! And make the cipher stronger if you wish!
Currently the cipher only substitutes letters - you could easily add digits, puncuation, whitespace and so
forth.…
Chapter 3 Solutions
Data Structures and Algorithms in Java
Ch. 3 - Prob. 1RCh. 3 - Write a Java method that repeatedly selects and...Ch. 3 - Prob. 3RCh. 3 - The TicTacToe class of Code Fragments 3.9 and 3.10...Ch. 3 - Prob. 5RCh. 3 - Prob. 6RCh. 3 - Prob. 7RCh. 3 - Prob. 8RCh. 3 - Prob. 9RCh. 3 - Prob. 10R
Ch. 3 - Prob. 11RCh. 3 - Prob. 12RCh. 3 - Prob. 13RCh. 3 - Prob. 14RCh. 3 - Prob. 15RCh. 3 - Prob. 16RCh. 3 - Prob. 17CCh. 3 - Prob. 18CCh. 3 - Prob. 19CCh. 3 - Give examples of values for a and b in the...Ch. 3 - Suppose you are given an array, A, containing 100...Ch. 3 - Write a method, shuffle(A), that rearranges the...Ch. 3 - Suppose you are designing a multiplayer game that...Ch. 3 - Write a Java method that takes two...Ch. 3 - Prob. 25CCh. 3 - Prob. 26CCh. 3 - Prob. 27CCh. 3 - Prob. 28CCh. 3 - Prob. 29CCh. 3 - Prob. 30CCh. 3 - Prob. 31CCh. 3 - Prob. 32CCh. 3 - Prob. 33CCh. 3 - Prob. 34CCh. 3 - Prob. 35CCh. 3 - Write a Java program for a matrix class that can...Ch. 3 - Write a class that maintains the top ten scores...Ch. 3 - Prob. 38PCh. 3 - Write a program that can perform the Caesar cipher...Ch. 3 - Prob. 40PCh. 3 - Prob. 41PCh. 3 - Prob. 42PCh. 3 - Prob. 43P
Additional Engineering Textbook Solutions
Find more solutions based on key concepts
Describe and implement state descriptions, move generators, terminal tests, utility functions, and evaluation f...
Artificial Intelligence: A Modern Approach
Thetakes the .class files containing the programs bytecodes and transfers them to primary memory.
Java How To Program (Early Objects)
Code an SQL statement that creates a table with all columns from the parent and child tables in your answer to ...
Database Concepts (7th Edition)
Consider the adage Never ask a question for which you do not want the answer. a. Is following that adage ethica...
Experiencing MIS
Since computers cannot be programmed in natural human language, algorithms must be written in a(n) _____ langua...
Starting Out With Visual Basic (7th Edition)
Practice Problem 8.7 (solution page 798) Write a program called Snooze that takes a single command-1ine argumen...
Computer Systems: A Programmer's Perspective (3rd Edition)
Knowledge Booster
Learn more about
Need a deep-dive on the concept behind this application? Look no further. Learn more about this topic, computer-science and related others by exploring similar questions and additional content below.Similar questions
- How to create a Caesar cipher program with the given rules?arrow_forwardA Caesar cipher is a simple substitution cipher based on the idea of shiftingeach letter of the plaintext message a fixed number (called the key) ofpositions in the alphabet. For example, if the key value is 2, the word"Sourpuss" would be encoded as "Uqwtrwuu." The original message canbe recovered by "reencoding" it using the negative of the key.Write a program that can encode and decode Caesar ciphers. The input to the program will be a string of plaintext and the value of the key.The output will be an encoded message where each character in the original message is replaced by shifting it key characters in the Unicode character set. For example, if ch is a character in the string and key is theamount to shift, then the character that replaces ch can be calculated as:chr (ord(ch) + key) .arrow_forwardImplement the first round of AES ( Advanced Encryption Standard ) in python. Given a message with 128 bits, two subkeys subkey0 and subkey1, your program should be able to perform one AddKey before Round 1 and the corresponding operations (SubBytes, ShiftRows, Mix-Columns, and AddKey) in Round 1, and output the result of the encryption after Round 1.arrow_forward
- Substitution ciphers are encryption/decryption algorithms that replace one letter or number with another. The first attested use of a substitution cipher in military affairs was by Julius Caesar, described by him in Gallic Wars (cf. Kahn pp83-84). In caesar cipher , you replace each letter by 3rd letter on. If it is out of bound (later than Z), then round to the head (letter A) and continue the shift. For example:meet me after the toga party PHHW PH DIWHU WKH WRJD SDUWB Please write a program in Java to implement the Caesar Cipher: a. Implement the encryption algorithm. Ask the user to input one all lower case normal sentence (called plaintext) using the nextLine method, and then output the encrypted text (called ciphertext). b. Implement the decryption algorithm. Ask the user to input one encrypted sentence (i.e. ciphertext) using the nextLine method, and then output the decrypted text (i.e. plaintext).arrow_forwardWrite a python program that takes a string as an input from the user and checks if there are any groups of THREE consecutive vowels. The input string will be a random combination of small letter and capital letter characters. Then replace all the three consecutive vowels with “#” character. So, the presence of such a group is ensuredarrow_forwardExample 2 Enter message to be encrypted: Dèyè mòn, gen mòn. Enter step size: -1 ORIGINAL MESSAGE Dèyè mòn, gen mòn. ENCRYPTED MESSAGE Cçxç lim, fdm lim. Enter message to be encrypted: Dèyè mòn, gen mòn. Enter step size: 0 ORIGINAL MESSAGE Dèyè mòn, gen mòn. ENCRYPTED MESSAGE Dèyè mòn, gen mòn. Enter message to be encrypted: QUIT Example 3 Enter message to be encrypted: Perfer et obdura, dolor hic tib: proderit olim. Enter step size: 8 ORIGINAL MESSAGE Perfer et obdura, dolor hic tibi proderit olim. ENCRYPTED MESSAGE Xmznmz m| wjl)zi, lwtwz pąk |qją xzwlmzą| wtqu. Enter message to be encrypted: QUITarrow_forward
- Write a program that receives a coded message file(Lab3ExtraCreditCT.txt) from your local espionage agent and decodes it into a file using standard English. The problem is your agent forgot to tell you the key used to decode the message. Fortunately, this is a simple substitution code consistently using 1 alphanumeric character to represent another, this is case sensitive. All other characters are not substituted, so a space will always be a space, a – will always be a –, a @ will always be a @, etcetera. You may use the following table to help you, it contains the most common letters used in the English language in descending order. E A R I O T N S L C U D P M H G B F Y W K V X Z J Q 0 5 3 2 4 6 8 1 9 7 Using the following key to convert plaintext to coded text: Plaintext = Now is the time for all good men to come to the aid of their country. Key = THEQUICKBROWNFXJMPSVLAZYDG The file your program outputs should look like this: Coded Text = Fxz bs vku vbnu ixp tww…arrow_forwardWrite a Python program that uses a token count to simulate a simple slot machine in which 3 numbers between 0and 8 are randomly selected and printed side-by-side. Your program should ask the slot machine user to input howmany tokens the user wishes to begin with. Print “JACKPOT!” if all three of the numbers are the same after a spinand increase the tokens by 10. Print “NICE MATCH!” if only two of the tokens are the same after a spin andincrease the token count by 3. In any case, it costs the user 1 token to spin. Continue playing until the userchooses to stop (print the final token count) or the token count reaches 0 (print “Sorry, you are out of tokens”). Ifthe user wants to spin again, instruct the user to hit a carriage return. If the user wants to quit, instruct theuser to type any other character before the carriage return. Always print out the final token count before yourprogram terminates. Your code needs to include a function spin_slots() that generates the three-digitrandom…arrow_forwardWrite a Program using any programming language you are comfortable with to implement Ceasar Shift cipher technique. The algorithm should take “plaint text” and key as input and gives the cipher text as output.arrow_forward
- The language used for the code is fortran 2008. Thank you 1. There are many algorithms that can be used to encrypt a message. One of these algorithms can be described as follows: • Choose a “code word”. For example, “fortran”. • Assign integer values to each of the characters in the code word corresponding to their placement in the alphabet. In the case of the code word “fortran”, the integer values would be (6, 15, 18, 20, 18, 1, 14). • Change each character in the message to be encrypted by adding the code word values determined above (in order) to each of the characters in the message to be encrypted. The code word is reused as many times as necessary. For example, suppose that we want to encrypt the message “hello”, we would first determine the integer values for each character in the message (8, 5, 12, 12, 15). Each of these values would be modified by adding the code word values, ie. (8+6, 5+15, 12+18, 12+20, 15+18) = (14, 20, 30, 32, 33). The resulting values are then translated…arrow_forwardwrite java program to accept any string(uppercase) and generate encrypted string string with following rules. 1.Each character in string is encrypted with previous and next two characters of that character in alphabet. example; . java prac02 YRG output: Encrypted string :WXZAPQSTEFHIarrow_forwardMany user-created passwords are simple and easy to guess. Write a program that takes a simple password and makes it stronger by replacing characters using the key below, and by appending "q*s" to the end of the input string. i becomes ! a becomes @ m becomes M B becomes 8 o becomes . Ex: If the input is: mypassword the output is: Myp@ssw.rdq*s Hint: Python strings are immutable, but support string concatenation. Store and build the stronger password in the given password variable.arrow_forward
arrow_back_ios
SEE MORE QUESTIONS
arrow_forward_ios
Recommended textbooks for you
- Database System ConceptsComputer ScienceISBN:9780078022159Author:Abraham Silberschatz Professor, Henry F. Korth, S. SudarshanPublisher:McGraw-Hill EducationStarting Out with Python (4th Edition)Computer ScienceISBN:9780134444321Author:Tony GaddisPublisher:PEARSONDigital Fundamentals (11th Edition)Computer ScienceISBN:9780132737968Author:Thomas L. FloydPublisher:PEARSON
- C How to Program (8th Edition)Computer ScienceISBN:9780133976892Author:Paul J. Deitel, Harvey DeitelPublisher:PEARSONDatabase Systems: Design, Implementation, & Manag...Computer ScienceISBN:9781337627900Author:Carlos Coronel, Steven MorrisPublisher:Cengage LearningProgrammable Logic ControllersComputer ScienceISBN:9780073373843Author:Frank D. PetruzellaPublisher:McGraw-Hill Education
Database System Concepts
Computer Science
ISBN:9780078022159
Author:Abraham Silberschatz Professor, Henry F. Korth, S. Sudarshan
Publisher:McGraw-Hill Education
Starting Out with Python (4th Edition)
Computer Science
ISBN:9780134444321
Author:Tony Gaddis
Publisher:PEARSON
Digital Fundamentals (11th Edition)
Computer Science
ISBN:9780132737968
Author:Thomas L. Floyd
Publisher:PEARSON
C How to Program (8th Edition)
Computer Science
ISBN:9780133976892
Author:Paul J. Deitel, Harvey Deitel
Publisher:PEARSON
Database Systems: Design, Implementation, & Manag...
Computer Science
ISBN:9781337627900
Author:Carlos Coronel, Steven Morris
Publisher:Cengage Learning
Programmable Logic Controllers
Computer Science
ISBN:9780073373843
Author:Frank D. Petruzella
Publisher:McGraw-Hill Education
Files & File Systems: Crash Course Computer Science #20; Author: CrashCourse;https://www.youtube.com/watch?v=KN8YgJnShPM;License: Standard YouTube License, CC-BY
UNIX Programming (Part - 10) The File System (Directories and Files Names); Author: ITUTEES;https://www.youtube.com/watch?v=K35faWBhzrw;License: Standard Youtube License