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
- Introductory: The Caesar Cipher technique is one of the earliest and simplest methods of encryption techniques. It is simply a type of substitution cipher, i.e., each letter of a given text is replaced by a letter some fixed number of positions down the alphabet. For example, with a shift of 1, A would be replaced by B, B would become C, and so on. The method is apparently named after Julius Caesar, who apparently used it to communicate with his officials. Thus, to cipher a given text we need an integer value, known as a shift which indicates the number of positions each letter of the text has been moved down. The encryption can be represented using modular arithmetic by first transforming the letters into numbers, according to the scheme, A = 0, B = 1 ,…, Z = 25. Encryption of a letter by a shift n can be described mathematically as. En(x) = (x+n) mod 26 (Encryption Phase with shift n) Write an algorithm and implement a program in C to read the data from a file (called…Language :Python write a program that asks the user to enter a series of single digit numbers with nothing seperating them. The program should display the sum of all the single digit numbers in the string. For example, if the user enters 2514 the method should return 12, which is hw sum of 2,5,1 and 4. write a program that reads a string from the user containing a date in the form mm/dd/yy. it should print the date in the format March 12, 2018.PLEASE NOTE: IT'S A TEXT BOOK EXERCISE. BOOK NAME: Fundamentals of Computer Programming with Programming Basics with C# (English) Problem: String Encryption Write a method Encrypt(char letter), which encrypts a given letter in the following way: It takes the first and the last digit from the ASCII code of the letter and concatenates them into a string, which will represent the result. In the beginning of the string, which represents the result, we will insert the symbol which matches the following condition: ASCII code of the letter + the last digit of the ASCII code of the letter. After that in the end of the string, which represents the result, you concatenate the character which matches the following condition: ASCII code of the letter - the first digit of the ASCII code of the letter. The method should return the encrypted string. Example: j → p16i ASCII code of j is 106 → First digit – 1, last digit – 6. We concatenate the first and the last digit → 16. At the beginning…
- Python Coding-(On Pycharm Community Edition) Create a mini-lottery with TEXT ticket. The user is going to save three numbers in a text file - those three numbers are from 1-9. In Python, create a program that reads those three numbers from the text file (ticket) Use a random number generator to draw three random numbers Compare the text ticket and the random numbers. If they match number (see below), output the prize The numbers can be in any order the random numbers can be duplicates, so be careful how you count! This work in a similar way to mini-assignment number 48 - but you DO NOT have to write to a text file. Have the user enter the numbers into the text file. Append the numbers read from the text file to a list read each number from the list and compare it to the randomly generated numbers you come up with One number match - free ticket Two numbers match - $2.00 Three numbers match - $10.00 -you don't have to complete bonus, it would be great if you could-…P1 P2 P3 P4 A pentagonal number is one that corresponds to dots arranged into a pentagon. Above are the first four pentagonal numbers and their pentagons. The pentagonal number PN has sides made of N dots. When you count the dots for a pentagonal number, include the dots for the inner pentagons. So to figure out how many dots PN has, find out how many P(N-1) has and add the dots for the new sides of size N. P1 = 1, P2 = 5, P3 = 12, P4 = 22 Figure out a recursive formula for PN and then write a function that implements it. That is, implement pentagonal() using recursion. pentagonal(1) -> 1 pentagonal(2) -> 5 pentagonal(3) -> 12In python The text file “studentMarks.txt” has been provided for you. Each line contains the Last Name, First Name and 8 marks separated by spaces of a single student. For each student in the file, adjust the file to include the average of their top 6 marks, rounded to 1 decimal place, at the end of the line. For example, in the file, the line may say: Mars, Bruno 82 82 85 94 65 79 81 90 Afterwards, it should be updated to say: Mars, Bruno 82 82 85 94 65 79 81 90 Top6Avg: 85.7 Your program must define a function to determine the average of the top 6 marks. You may define more functions as needed for your program.
- Language: Java Write a program that reads a sentence from the keyboard. Depending on the last character of the sentence, print the message identifying the sentence as declarative (ends with a period), interrogative (ends with a question mark), exclamatory (end with an exclamation point), or other. Hint: you can use charAt() method from the String class to extract the last character of the input line. The character of a String str is at str.length()-1 position. For taking a sentence as input use the nextLine() method from the Scanner class. You have to use if/else if selection. Sample input and output: Sample 1 Input: How are you? Output: Interrogative Sample 2 Input: I am good. Output: Declarative Sample 3 Input: That is amazing! Output: Exclamatory Sample 4 Input: Although, Output: Other Answer:Project 9: The digital root of a positive integer is found by summing the digits of the integer. If the resulting value is a single digit then that digit is the digital root. If the resulting value contains two or more digits, those digits are summed and the process is repeated. This is continued as long as necessary to obtain a single digit. For example, consider the positive integer 24. Adding the 2 and the 4 yields a value of 6. Since 6 is a single digit, 6 is the digital root of 24. Now consider the positive integer 39. Adding the 3 and the 9 yields 12. Since 12 is not a single digit, the process must be repeated. Adding the 1 and the 2 yields 3, a single digit and also the digital root of 39. File: Input The input file will contain a list of positive integers, one per line. The end of the input will be indicated by an integer value of zero. Output File: For each integer in the input, output its digital root on a separate line of the output. Example Input: 24 39…please code in python You place a pawn at the top left corner of an n-by-n chess board, labeled (0,0). For each move, you have a choice: move the pawn down a single space, or move the pawn down one space and right one space. That is, if the pawn is at position (i,j), you can move the pawn to (i+1,j) or (i+1, j+1). Ask the user for the size of a chessboard, n (integer). Find the number of different paths starting from (0,0) that the pawn could take to reach each position on the chess board. For example, there are two different paths the pawn can take to reach (2,1). Look at the diagrams below to convince yourself of this. You can see the four paths that you can take by move 2. Start -> Move 1 -> Move 2 (0,0) -> (1,0) -> (2,1) (0,0) -> (1,0) -> (2,0) (0,0) -> (1,1) -> (2,1) (0,0) -> (1,1) -> (2,2) Print the board with the number of ways to reach each square labeled as shown below. For example: Enter a board size: 4 1 0 0 0 1 1 0 0 1 2 1 0 1 3 3 1
- write legibly.Programming language : Java Write an application that prints the initials "SP" in large block letters. Make each large letter out of the corresponding characters. Please use escape sequences to form the initials!In Python, The function add_char_counts takes three parameters: a string s and two strings of length 1, char1 and char2, and returns the total number of times either char1 or char2 appears in s. For example, the word "scallions" has 2 s's and 1 n, so add_char_counts("scallions", "s", "n") returns 3. Hint: Use a string method to help solve this problem (count). You do not need an accumulator. For example: Test Result print(add_char_counts('Indiana', 'a', 'b')) 2 print(add_char_counts('BAHAMAS', 'A', 'B')) 4 print(add_char_counts('Mississippi', 'i', 'M')) 5 print(add_char_counts("spam spam spam spam", "s", "p")) 8