Assignment 7B: Caesar Cipher. One of the simplest methods to encrypt a message is to "shift" the letters by a literal value. For example, if we take the letter 'A' and shift it by 2, we get 'C'. This "substitution cipher" gets its name from the Roman emperor Julius Caesar, who was one of the first person known to encode secret messages this way. For this assignment, you will create a program that prompts the user for a message to encode, as well as an offset to encrypt it with. You will then create and use the following methods:
Q: Task 2 Get Binary 1: Implement the get_bin_1 function as directed in the comment above the…
A: I have implemented the tasks as per the given instruction. To implement the first task, that is, to…
Q: X166: nestParen Given a string, return true if it is a nesting of zero or more pairs of parentheses,…
A: Given To complete the java function public boolean nestParen(String str) { }
Q: The coding language is python The code in there may or not be correct I was playing around with it…
A: PROGRAM: # The user in prompted for input and stored in userInput userInput = str(input("Enter the…
Q: python
A: Given :- A contact list is a place where you can store a specific contact with other associated…
Q: public static String reverseVowels(String text) Given a text string, create and return a new string…
A: Given data is shown below:
Q: Some sample runs of the program are included below (user input is in bold): > java ThreeWords Enter…
A: As per our guidelines, we are supposed to answer only one question. Kindly repost the remaining…
Q: Q1: Write a program that reads a set of N integers. Then, the program finds and outputs the sum of…
A: Below I have provided a python program for the given question. Also, I have attached a screenshot of…
Q: Q7: Write a program that reads a collection of car speeds as long as the speeds do not exceed 100…
A: Program Approach: Including necessary header files Using namespace for standard input output…
Q: A program has a String variable fullName that stores a first name, followed by a space, followed by…
A: The answer in given in the below step with proper explanation and coding example...
Q: C++ A robot is initially located at position (0; 0) in a grid [?5; 5] [?5; 5]. The robot can move…
A: The below given C++ program will obey the following rubrics: Including necessary header files.…
Q: In the program below for decomposing the entered number into its prime numbers, the location of the…
A: Find the required answer with explanation given as below :
Q: Part A Find a list of all of the names in the following string using regex. In [ ]: import re def…
A: The answer is given below:-
Q: A contact list is a place where you can store a specific contact with other associated information…
A: #creating an empty dictionary to store name-contact number pairscontact_list=dict()#asking user to…
Q: QUESTION 10 def cube (number): for i in range (number, number): for j in range (number) : print…
A: In place of FILL THIS PART just write number*number*number Hence the answer to be filled in the box…
Q: Assignment4A: Let's Play Bunco! Now that we are able to repeat actions easily with loops, we can…
A: the code is given below:
Q: y user-created passwords are simple and easy to guess. Write a program that takes a simple password…
A: Here no language is mentioned so I have given C++ code to modify the password given below.
Q: In the program below for decomposing the entered number into its prime numbers, the location of the…
A: The correct answer of the above MCQ is b. ss:do{
Q: QUESTION 12 Multiple Choice: What is the output of the code below? public static void main(String]…
A: Question 12: class HelloWorld { public static void main(String[] args) { String str…
Q: Run code below and fix it. mylist =…
A: The problem is about correction of the python code.
Q: USE THE PROGRAM CODE BELOW TO CODE 1. COMMAND LINE ARGS CODE IN JAVA 1. Command Line Args…
A: Hello student, hope you are doign good. In this question, the program needs to be modified such…
Q: In C, Given an int variable n that has already been declared, write some code that repeatedly reads…
A: //include the required header file #include <stdio.h> //define main function int main() {…
Q: please code in python You are probably familiar with the famous Fibonacci sequence of numbers,…
A: The question is to write the recursive python code for the given problem.
Q: int a[ 10] = {1,5,3,8,4,2,6,9,7}; int *p; p = &a[2]; p[0] = 10; p[1] = 15; What are the values of a?
A: Required:
Q: Code Example: def get_volume (width, height, length=2): width * * height length volume return volume…
A: Functions in python: A function is a group of connected claims that together carry out a…
Q: What method of the Character class is used to change a given character value to a capital letter if…
A: Answer: w. toUpperCase
Q: public static String pancakeScramble(String text) This nifty little problem is taken from the…
A: Code: public class Scramble { public static void main(String[] args) {…
Q: Expand positive integer intervals def expand_intervals(intervals): An interval of consecutive…
A: Code: from typing import List, NoReturn, Any def collapse_intervals(items: List[int]) -> str:…
Q: 1- write the removeLast function which removes the last digit from a given number, if the number…
A: PROGRAM EXPLANATION(C++): Include the header file. Define the remove last function, this function…
Q: PYTHON ONLY Please finish off this movie collection progam/code a) define print_longest_movies To…
A: Answer:
Q: Language :Python write a program that asks the user to enter a series of single digit numbers with…
A: Program: #Function to compute sum of all the single digit numbers in the string def…
Q: Exercise 6 Write a recursive method that returns a string that contains the binary representation of…
A: Please give positive ratings for my efforts. Thanks. PROGRAM #include <bits/stdc++.h>…
Q: Write a program that first takes in word pairs that consist of a name and a phone number (both…
A: function main: Start read details make a list out of details initialize name with last element in…
Q: Siven positive integer numinsects, write a while loop that prints that number doubled without…
A: ALGORITHM: STEP 1: create a class called InsectGrowth. STEP 2: In main class using the scanner to…
Q: 6. A certain game keeps track of the maximum and minimum scores obtained so far. If num represents…
A: The given scenario is to update the value of "num" by the minimum and maximum scores. The variable…
Q: Expand positive integer intervals def expand_intervals(intervals): An interval of consecutive…
A: split() will split a string to list based on the given delimiter len() will be used to find the…
Q: A contact list is a place where you can store a specific contact with other associated information…
A: Method: 1 In this method, we will take the list from the user and convert it to a dictionary using…
Q: Write a function that finds the number of occurrences of a specified character in a string using the…
A: Define function counts with parameter s and ch. Define variable occ and initialize it to 0. Use for…
Q: You are given a string. Get input from the user. In the first line, print the third character of…
A: As per the requirement program is developed. Note: In the question any programming language is not…
Q: Project 1: Caesar Cipher Assignment Overview In this assignment, we are going to implement a simple…
A: Code: def enc():text,s=input("Enter the string to be encoded: "),int(input("Enter the shift…
Q: Can u debug this Program gets a store's department code and a sale transaction value // Output is a…
A: start declare num dept declare num saleValue declare num NUM_DEPTS = 5 declare num total[NUM_DEPTS]…
Q: 3. Randomly generate a number in range [1, 12]. Map this number to a season: if the number is 3, 4,…
A: The random numbers can be generated in Java using the objects of the predefined Random class. This…
Q: Java program I need help writing a program that has 3 methods: the main method, a method that swaps…
A: Given: We have to make a program consisting: 1) main method 2) method for swapping digits of a…
Q: The English-Spanish dictionary: Spanish Dictionary: An incomplete dictionary file (dict.txt) is…
A: Step 1 : Start Step 2 : Open the dict.txt file in read mode , and Store the lines of the Dictionary…
Q: 3. Complete the function count_digits. This function takes one parameter - a string (s). It should…
A: Note: We are allowed to answer one question at a time, according to the BNED Guidelines. For the…
Q: Create an iterator that returns numbers, starting with 1, and each sequence will increase by one…
A: here in the given question ask for a program in python ,in that requirement is create an iterator…
Q: 15. Use sets to find the two six-digit numbers with all different digits where the square of the…
A: c=0for i in range(100000,1000000): s=set(list(map(int, str(i)))) if len(s)==6: m=i*i…
Q: Assignment 7B: Caesar Cipher. One of the simplest methods to encrypt a message is to "shift" the…
A: 1) Below is C++ program that prompts user for a message to encode, as well as an offset to encrypt…
Q: 7. username_ends_with_digits This function decides whether a given username ends with some digits.…
A: The Python code along with the screenshot of code and output is given below.
Q: In C++, how to read a number with decimal in input file and write that decimal number in output…
A: To read the third line string name, you can continue using fin >> name3 so that the next…
Q: P#3. Even fellows (amigos "pares"). Using different starting values, a sequence can be expressed as…
A: The sequence is started from a starting value. The next term in the sequence is half of the previous…
Solving this problem in the Java language
Trending now
This is a popular solution!
Step by step
Solved in 4 steps with 3 images
- Exercise 11.10. Two words are “rotate pairs” if you can rotate one of them and get the other (see rotate_word in Exercise 8.12). Exercise 8.12. ROT13 is a weak form of encryption that involves “rotating” each letter in a word by 13 places. To rotate a letter means to shift it through the alphabet, wrapping around to the beginning if necessary, so ’A’ shifted by 3 is ’D’ and ’Z’ shifted by 1 is ’A’. Write a function called rotate_word that takes a string and an integer as parameters, and that returns a new string that contains the letters from the original string “rotated” by the given amount. For example, “cheer” rotated by 7 is “jolly” and “melon” rotated by -10 is “cubed”. You might want to use the built-in functions ord, which converts a character to a numeric code, and chr, which converts numeric codes to characters. Potentially offensive jokes on the Internet are sometimes encoded in ROT13. If you are not easily offended, find and decode some of them. Please solve Exercise 11.10 -…C++ Create a Blackjack (21) game. Your version of the game will imagine only a SINGLE suit of cards, so 13 unique cards, {2,3,4,5,6,7,8,9,10,J,Q,K,A}. Upon starting, you will be given two cards from the set, non-repeating. Your program MUST then tell you the odds of receiving a beneficial card (that would put your value at 21 or less), and the odds of receiving a detrimental card (that would put your value over 21). Recall that the J, Q, and K cards are worth ‘10’ points, the A card can be worth either ‘1’ or ‘11’ points, and the other cards are worth their numerical values. FOR YOUR ASSIGNMENT: Provide two screenshots, one in which the game suggests it’s a good idea to get an extra card and the result, and one in which the game suggests it’s a bad idea to get an extra card, and the result of taking that extra card.Caesars Cypher in C programming language How do you program an encryption and decryption for a Caesars Cypher that covers all the possible ASCII characters? In this there should be a shift over K = 5 but the example below is K = 3. This should result in actual character and not the control ASCII represenations. For example: >>> $ encrypt(I have a key)N%mf{j%f%pj~>>> $ encrypt(see me at 3)xjj%rj%fy%8>>> $ decrpyt(|jfw%ns%gqzj)wear in blue Assume that the text parsing method has been succesful and it's the encryption/decryption of the char array that needs to be factored. Formula Encryption -> C = E(k, P) = (P + k) (mod 26) Decryption -> P = D(k, C) = (C - k) (mod 26) Where k = 5
- PLEASE CODE IN PYTHON Crypto Columns The columnar encryption scheme scrambles the letters in a message (or plaintext) using a keyword as illustrated in the following example: Suppose BATBOY is the keyword and our message is MEET ME BY THE OLD OAK TREE. Since the keyword has 6 letters, we write the message (ignoring spacing and punctuation) in a grid with 6 columns, padding with random extra letters as needed: MEETME BYTHEO LDOAKT REENTH Here, we've padded the message with NTH. Now the message is printed out by columns, but the columns are printed in the order determined by the letters in the keyword. Since A is the letter of the keyword that comes first in the alphabet, column 2 is printed first. The next letter, B, occurs twice. In the case of a tie like this we print the columns leftmost first, so we print column 1, then column 4. This continues, printing the remaining columns in order 5, 3 and finally 6. So, the order the columns of the grid are printed would be 2, 1, 4, 5, 3, 6, in…In Python, grades = {'Tim': [87,96,70], 'Sue': [100,87,90], 'Jack': [94,77,90], 'Kevin': [100,81,82], 'Bart': [83, 65, 85]} Ask user to enter the names of the rows, i.e., indices. You can use: len(grades) to get the number of rows of the DataFrame. In addition, using the sort_index() method, ask user whether they wish to sort by rows or by columns and whether to sort in ascending or descending order (do not use any if-else statements) '''In java, without Arrays and using only String methods ( don't use String builder) // Question 17: In MS-DOS, a file name consists of up // to 8 characters (excluding '.', ':', backslask, '?', // and '*'), followed by an optional dot ('.' character) // and extension. The extension may contain zero to three // characters. For example, 1STFILE.TXT is a valid filename. // Filenames are case-blind. // // Write and test a method that takes // in a String, validates it as a valid MS-DOS file // name, appends the extensions ".TXT" if no extension // is given (that is, no '.' appears in FILENAME), converts // the name to uppercase, and returns the resulting string // to the calling method // If fileName ends with a dot, remove that dot and do not // append the default extension. If the name is invalid, // validFileName should return null. public String validFileName(String n) { }
- <<Write in Java>> - Challenge 7 File encryption is the science of writing the contents of a file in a secret code. Your encryption program should work like a filter, reading the contents of one file, modifying the data into a code, and then writing the coded contents out to a second file. The second file will be a version of the first file, but written in a secret code. Although there are complex encryption techniques, you should come up with a simple one of your own. For example, you could read the first file one character at a time, and add 10 to the character code of each character before it is written to the second file. - Challenge 8 Write a program that decrypts the file produced by the program in Programming Challenge 7. The decryption program should read the contents of the coded file, restore the data to its original state, and write it to another fileTask 2 Get Binary 1: Implement the get_bin_1 function as directed in the comment above the function. If the directions are unclear, run the code, and look at the expected answer for a few inputs. In order to be able to compare your solution to the answer, you cannot simply print out the binary directly to the console. Instead, you have been provided with a very rudimentary stringbuilder implementation that allows you to build a string one character at a time, without the ability to erase. There are comments at the top of the code explaining how to use the stringbuilder, however you could also see how it is being used in task_2_check. Note: if you create a stringbuilder and append ‘a’, ‘b’, then ‘c’, the resulting string will be “abc” when printed. You are free to read through the stringbuilder implementation, but it is quite complicated in order to make it easy to use. As specified in the comment, you may not use division (/) or mod (%) to implement this function (as the check…USE THE PROGRAM CODE BELOW TO CODE 1. COMMAND LINE ARGS CODE IN JAVA 1. Command Line Args Modify problem # 1 from Lab 8 to accept the values for the key as command line arguments. Your program may assume the arguments given at the command line are integers. If there are no arguments, print a message. If there is at least one argument, compute and print the average of the arguments. Note that you will need to use the parseInt method of the Integer class to extract integer values from the strings that are passed in. If any non-integer values are passed in, your program will produce an error, which is unavoidable at this point. Test your program in NetBeans using the data for problem # 1 Lab 8 as command line arguments. import java.util.Scanner;import java.text.NumberFormat; public class Quizzes{ //---------------------------------------------- // Read in the number of questions followed by // the key, then read in each student's answers // and calculate the number…
- I already have the code for the assignment below, but there are some errors in the code. Please help me fix the code. The assignment: Continue Exercise •• P13.1, checking the words against the /usr/share/dict/words on your computer, or the words.txt file in the companion code for this book. For a given number, only return actual words. The code of resource class: import java.io.File;import java.io.FileNotFoundException;import java.util.ArrayList;import java.util.Scanner; public class U10P02R{ static ArrayList<String> words = new ArrayList<String>(); U10P02R(){ try { File myObj = new File("words.txt"); Scanner myReader = new Scanner(myObj); while (myReader.hasNextLine()) { String data = myReader.nextLine(); words.add(data); } myReader.close(); } catch (FileNotFoundException e) { System.out.println("An error occurred."); e.printStackTrace(); } } // This method to returns a character array…PYTHON ONLYPlease finish off this movie collection progam/code a) define print_longest_moviesTo complete the interactive loop, you must instantiate a Movie object using the information provided by the user and add it to the MovieCollection object using the provided add_movie method.b) complete the interactive loop This method is to take no arguments and print the title and duration of the top three longest movies in descending order (i.e. highest to lowest). Additionally, each movie should be numbered in the output (i.e. the longest movie is 1, the second longest is 2, etc). Here's an example of output which could be produced when print_longest_movies is called: 1. Titanic (194 minutes)2. Vertigo (128 minutes)3. Jaws (124 minutes) the code: class Movie:def __init__(self, title, duration):self.title = titleself.duration = durationdef get_movie_duration(movie):return movie.durationclass MovieCollection:def __init__(self):self.movies = []def add_movie(self,…I already have the code for the assignment below, but there is some errors in the code. Please help me fix them. The assignment: Make a telephone lookup program. Read a data set of 1,000 names and telephone numbers from a file that contains the numbers in random order. Handle lookups by name and also reverse lookups by phone number. Use a binary search for both lookups. This assignment needs a resource class and a driver class. The resource class and the driver class will be in two separate files. The resource class will contain all of the methods and the driver class only needs to call the methods. The driver class needs to have only 5 lines of code. The code needs to be written in Java. Please help me with exactly what I asked for help. The code: PhoneLookup.java import java.io.FileReader;import java.io.IOException;import java.util.Scanner; public class PhoneLookup{ public static void main(String[] args) throws IOException { Scanner in = new Scanner(System.in);…