Write a program that produces a Caesar cipher of a given message string. A Caesar cipher is formed by rotating each letter of a message by a given amount. For example, if your rotate by 3, every A becomes D; every B becomes E; and so on. Toward the end of the alphabet, you wrap around: X becomes A; Y becomes B; and Z becomes C. Your program should prompt for a message and an amount by which to rotate each letter and should output the encoded message.

Answers

Answer 1

Answer:

Here is the JAVA program that produces Caeser cipher o given message string:

import java.util.Scanner;  //to accept input from user

public class Main {  

   public static void main(String args[]) {  //start of main function

       Scanner input = new Scanner(System.in);  //creates object of Scanner

       System.out.println("Enter the message : ");  //prompts user to enter a plaintext (message)

       String message = input.nextLine();  //reads the input message

       System.out.println("Enter the amount by which by which to rotate each letter : ");  //prompts user to enter value of shift to rotate each character according to shift

       int rotate = input.nextInt();  // reads the amount to rotate from user

       String encoded_m = "";  // to store the cipher text

       char letter;  // to store the character

       for(int i=0; i < message.length();i++)  {  // iterates through the message string until the length of the message string is reached

           letter = message.charAt(i);  // method charAt() returns the character at index i in a message and stores it to letter variable

           if(letter >= 'a' && letter <= 'z')  {  //if letter is between small a and z

            letter = (char) (letter + rotate);  //shift/rotate the letter

            if(letter > 'z') {  //if letter is greater than lower case z

               letter = (char) (letter+'a'-'z'-1); }  // re-rotate to starting position  

            encoded_m = encoded_m + letter;}  //compute the cipher text by adding the letter to the the encoded message

           else if(letter >= 'A' && letter <= 'Z') {  //if letter is between capital A and Z

            letter = (char) (letter + rotate);  //shift letter

            if(letter > 'Z') {  //if letter is greater than upper case Z

                letter = (char) (letter+'A'-'Z'-1);}  // re-rotate to starting position  

            encoded_m = encoded_m + letter;}  //computes encoded message

           else {  

         encoded_m = encoded_m + letter;  } }  //computes encoded message

System.out.println("Encoded message : " + encoded_m.toUpperCase());  }} //displays the cipher text (encoded message) in upper case letters

Explanation:

The program prompts the user to enter a message. This is a plaintext. Next the program prompts the user to enter an amount by which to rotate each letter. This is basically the value of shift. Next the program has a for loop that iterates through each character of the message string. At each iteration it uses charAt() which returns the character of message string at i-th index. This character is checked by if condition which checks if the character/letter is an upper or lowercase letter. Next the statement letter = (char) (letter + rotate);   is used to shift the letter up to the value of rotate and store it in letter variable. This letter is then added to the variable encoded_m. At each iteration the same procedure is repeated. After the loop breaks, the statement     System.out.println("Encoded message : " + encoded_m.toUpperCase()); displays the entire cipher text stored in encoded_m in uppercase letters on the output screen.

The logic of the program is explained here with an example in the attached document.

Write A Program That Produces A Caesar Cipher Of A Given Message String. A Caesar Cipher Is Formed By
Answer 2

In this exercise we have to use the computer language knowledge in JAVA to write the code as:

the code is in the attached image.

In a more easy way we have that the code will be:

import java.util.Scanner;

public class Main {  

  public static void main(String args[]) {

      Scanner input = new Scanner(System.in);

      System.out.println("Enter the message : ");

      String message = input.nextLine();  

      System.out.println("Enter the amount by which by which to rotate each letter : ");  

      int rotate = input.nextInt();  

      String encoded_m = "";  

     char letter;  

      for(int i=0; i < message.length();i++)  {

          letter = message.charAt(i);

          if(letter >= 'a' && letter <= 'z')  {  

           letter = (char) (letter + rotate);  

           if(letter > 'z') {  

              letter = (char) (letter+'a'-'z'-1); }

           encoded_m = encoded_m + letter;}  

          else if(letter >= 'A' && letter <= 'Z') {

           letter = (char) (letter + rotate);  

           if(letter > 'Z') {  

               letter = (char) (letter+'A'-'Z'-1);}

           encoded_m = encoded_m + letter;}  

          else {  

        encoded_m = encoded_m + letter;  } }

System.out.println("Encoded message : " + encoded_m.toUpperCase());  }}

See more about JAVA at brainly.com/question/2266606

Write A Program That Produces A Caesar Cipher Of A Given Message String. A Caesar Cipher Is Formed By

Related Questions

Proper numeric keyboarding technique includes all of these techniques except
O keeping your wrist straight
O resting your fingers gently on the home keys
O looking at the keys
O pressing the keys squarely in the center

Answers

The answer is looking at the keys

Answer: Its the 1st choice, 2nd choice, and the final one is the 4th one. (NOT the third answer choice)

Explanation: (I just took the test)... Hopefully this helps and good luck.

Web pages are accessed through a software program called a _____.A) ​web crawlerB) ​web browserC) ​web serverD) ​web app drawer

Answers

Answer: B) ​web browser

Explanation: A web browser may be explained as a software program or application available on various operating systems such as windows, Mac, Android, iOS among others. This program acts as an interface between information available on websites or pages and users. This application takes a specified uniform resource locator or web address as input and outputs the information available on a web page. Google Chrome, Internet Explorer, Microsoft edge, opera mini, Safari, Firefox and so on.

if you exit a program without saving the document on which you are working, or the computer accidentally losses electrical power, the document will be lost

Answers

Depends on which program you are using. Some programs automatically save your work, even if you exit out of it or turn off your computer

What do you think is the single greatest physical threat to information systems? Fire? Hurricanes? Sabotage? Terrorism? Something else? Discuss this question and provide support for your answer.

Answers

Answer:

The single greatest physical threat to information systems is:

Sabotage

Explanation:

Sabotage describes the efforts of internal persons to ensure that a system does not operate as intended or is destroyed.  Among the threats to information systems, this is the greatest.  The problem with sabotage is that the operators are internal, they know the system very well.  They understand the weak points and the strengths of the system.  They are internal terrorists to any information system.  These internal saboteurs are capable of using any means to achieve their purpose.  Therefore, it is necessary to scrutinize employees from time to time to discover internal risks.

Write a program that prompts the user to input an integer that represents the money in cents. The program will the calculate the smallest combination of coins that the user has. For example, 42 cents is 1 quarter, 1 dime, 1 nickel, and 2 pennies. Similarly, 49 cents is 1 quarter, 2 dimes, and 4 pennies

Answers

Answer:

The program in Python is as follows:

cents = int(input("Cent: "))

quarter = int(cents/25)

if quarter > 1:

     print(str(quarter)+" quarters")

elif quarter == 1:

     print(str(quarter)+" quarter")

cents = cents - quarter * 25

dime = int(cents/10)

if dime>1:

     print(str(dime)+" dimes")

elif dime == 1:

     print(str(dime)+" dime")

cents = cents - dime * 10

nickel = int(cents/5)

if nickel > 1:

     print(str(nickel)+" nickels")

elif nickel == 1:

     print(str(nickel)+" nickel")

penny = cents - nickel * 5

if penny > 1:

     print(str(penny)+" pennies")

elif penny == 1:

     print(str(penny)+" penny")

Explanation:

This line prompts user for input in cents

cents = int(input("Cent: "))

This line calculates the number of quarters in the input amount

quarter = int(cents/25)

This following if statement prints the calculated quarters

if quarter > 1:

     print(str(quarter)+" quarters")

elif quarter == 1:

     print(str(quarter)+" quarter")

cents = cents - quarter * 25

This line calculates the number of dime in the input amount

dime = int(cents/10)

This following if statement prints the calculated dime

if dime>1:

     print(str(dime)+" dimes")

elif dime == 1:

     print(str(dime)+" dime")

cents = cents - dime * 10

This line calculates the number of nickels in the input amount

nickel = int(cents/5)

This following if statement prints the calculated nickels

if nickel > 1:

     print(str(nickel)+" nickels")

elif nickel == 1:

     print(str(nickel)+" nickel")

This line calculates the number of pennies in the input amount

penny = cents - nickel * 5

This following if statement prints the calculated pennies

if penny > 1:

     print(str(penny)+" pennies")

elif penny == 1:

     print(str(penny)+" penny")

How has technology influenced space exploration?

Answers

Answer:

One of the biggest benefits of machine learning when it comes to space exploration is that programs can sift through the available data more easily than humans, which increases the chance of finding planets just by looking at datasets. It's even thought that AI could be instrumental in locating extra-terrestrial life.

Explanation:

paragraph on how atms work

Answers

ATM (Automatic Teller Machine) is a banking terminal that accepts deposits and dispenses cash. ATMs are activated by inserting cash (in cases of ATM Depositing) or debit /credit card that contain the user's account number and PIN on a magnetic stripe (for cash withdrawals)

What benefits does the Domain Name System (DNS) provide? Check all that apply.
Network Address Translation (NAT)
Ease of address memorization
Assigning Internet Protocol (IP) addresses
Easy mapping to a new Internet Protocol (IP) address

Answers

Answer:

Option C (Assigning Internet Protocol (IP) addresses) is the correct choice.

Explanation:

DNS is a centralized process for resolving as well as continuing to give IP addresses for something like a specified domain name, a method that allows you to search a site via your web browsers whenever you tab or switch on any web server (Internet Explorer, chrome, respectively.).This helps everyone to still have throughput mostly on the network although one of the databases becomes offline for maintenance.

All other options are not relevant to the situation in question. It is the right answer to all of the above.

Answer:the TCP

Explanation:

Discuss the main characteristics of the database approach and how it differs from traditional file systems.

Answers

The database system allows the creation of a single depository of information, which is updated periodically and which can be used simultaneously by many users, since this type of system allows the effective sharing of all data stored in its depository . In addition, this is a secure system and is very difficult to break into. This is because of the efficiency of the software used to maintain it. However, the use of these softwares can be a little complicated for users, in addition to requiring a high economic cost to obtain them.

The traditional file system, in turn, each user must obtain their own file related to the application they want to run. This may seem dull in comparison to the database, but it is advantageous as it does not require any spending on software, as it is simple and there are several cheap and efficient tools and editors on the market. However, this system is not so safe, it can cause isolation of data and even data inconsistency, which disrupts the entire system.

Recursion is a natural use for a _____ (stack or queue)

Answers

Answer:

Stack

Explanation:

Any function that call itself can be regarded as recursive function, it should be noted that Recursion is a natural use for a stack, especially in the area of book keeping.

Recursion is very important because some of problems are usually recursive in nature such as Graph and others, and when dealing with recursion , only base and recursive case is needed to be defined.

Some areas where recursion is used are in sorting and searching.

_______tools enable people to connect and exchange ideas.A) Affective computing. B) Social media. C) Debugging D) Computer forensics.

Answers

Answer:

B) Social media.

Explanation:

Social media is well, a media, that allows you to share things with people and have discussions.

How many pins are in the power supply connector that is typically used on most motherboards today?

Answers

Answer: 4 pins

Explanation:

Answer: 20+4 ATX pins.

Explanation: If you’re talking about supplying power from the PSU to the Motherboard then it would be the 20+4 pin connector. Back on old ATX motherboards it used to be the 20 pin connector.

Today technology is based in Science and engineering, earlier it was based on
__________ _____-_____.

Answers

Answer:

Technical know-how

Explanation:

C++ code pls write the code

Answers

Answer:

Following are the code to this question:

#include<iostream>//defining header file

using namespace std;

class vec//defining class vec  

{

int x, y, z; //defining integer varaible x, y, z

public: // using public access specifier

vec() //defining default constructor

{

   x = 0; //assign value 0 in x variable  

   y = 0; //assign value 0 in y variable

   z = 0;//assign value 0 in z variable

}

vec(int a, int b , int c) //defining parameterized constructor vec

{

   x = a; //assign value a in x variable

   y = b; //assign value b in y variable

   z = c;//assign value c in z variable

}

void printVec() //defining a method printVec

{

   cout<<x<<","<<y<<","<<z<<endl; //use print method to print integer variable value

}

//code

vec& operator=(const vec& ob) //defining operator method that create object "ob" in parameter  

{

x=ob.x; //use ob to hold x variable value

y=ob.y;//use ob to hold y variable value

z=ob.z;//use ob to hold z variable value

return *this;//using this keyword to return value  

}

};

int main()//defining main method

{

vec v(1,2,3);//calling parameterized constructor

vec v2; //creating class object to call method

v2=v; //creatring reference of object

v2.printVec(); //call method printVec

return 0;

}

Output:

1, 2, 3

Explanation:

In the above-given code part, a method "operator" is defined, that accepts an object or we can say that it is a reference of the class "ob", which is a constant type. Inside the method, the object is used to store the integer variable value in its variable and use the return keyword with this point keyword to return its value.    

$8.25/hour; _____$/year, when working 40 hours a week.

Answers

if you work 50 weeks/year and 40 hours/week, you will make 16,500 dollars per year if you make 8.25 per hour

Students who respond promptly to e-mails are following which netiquette rule?

A. keeping content appropriate
B. assessing an online environment
C. respecting everyone’s time
D. practicing ethical behaviors

Answers

Answer:

respecting everyone's time

Explanation:

they don't make people wait for a response

Its Option C - Respecting Everyone’s Time.
Thank you!

When does the VB.NET programming environment start to operate?
A. once a VB.NET project is compiled
B. once a VB.NET project is created in the Microsoft Visual Studio environment
C. once a VB.NET project is debugged
D. once a VB.NET project folder is opened
E. All of the above are correct

Answers

Answer:

B. once a VB.NET project is created in the Microsoft Visual Studio environment.

Explanation:

Visual Basic . Net is a programming language which is used to run complex software and projects. The VB projects which are created in Microsoft Visual Studio are run by console application. These computer applications run complex and technical software.

How can you say that a computer is a versatile machine?​

Answers

Answer:

A computer is a versatile machine because is used for many purposes,a modern day computer can run multiple data at once making a fast and efficient machine very durable and effective for our use in all areas of life.

Clicking and double-clicking are two of the five

Answers

Answer:

The correct answer is events

Egyptian hieroglyphs were part of a writing system used by the ancient Egyptians. What type of graphic design elements did they contain?

Answers

Answer:

Logographic, syllabic, and alphabetic elements. I think thts what u were asking for?

Explanation:

Which of the following statement about device formatting is FALSE?
A) Device manufacturers store the initial file-system data structures in the device.
B) Operating system can create multiple partitions with in a single device.
C) Volume creation is implicit when a file system is placed directly within a partition.
D) Not every partition contains a copy of the operating systems.

Answers

Answer:

The correct option is;

A) Device manufacturers store the initial file-system data structures in the device.

Explanation:

Before a storage device can be used for data storage, it is required to prepare the device for use and to make the device to become visible to the operating system by formatting of the device

New storage devices are not pre-formatted or come with a ready to use file system as there are different file systems specifically designed for particular  operating systems or operating environment.

Formatting creates partitions, makes the hard drive visible to the operating system and creates a file system that is new such that the storage device can be used for storing files.

Research and a well-written problem statement are important because A)they give a clear understanding of the problem and its solution. B)they ensure that anyone in the general public will be able to understand and solve the problem. C)they give a list of the needs of the stakeholders. D)they ensure that questions still need to be asked about the problem.

Answers

Answer:

A. they give a clear understanding of the problem and it's solution

Explanation:

Research and a well-written problem statement are important because they give a clear understanding of the problem and its solution.

Answer:

Research and a well-written problem statement are important because

they give a clear understanding of the problem and its solution.

they ensure that anyone in the general public will be able to understand and solve the problem.

they give a list of the needs of the stakeholders.

they ensure that questions still need to be asked about the problem.

_______ tools enable people to connect and exchange ideas.
A) Affective computing.
B) Social media.
C) Debugging
D) Computer forensics.

Answers

Social media is a tool that enables people to connect and exchange ideas. Thus the correct option is B.

What is communication?

Communication is referred to the exchange of information between two individuals in the form of conversation, opinion, suggestion, or advice with the help of medium or direct interaction.

Social media is referred to as a tool of communication that enables people to share their ideas, thoughts, and opinions with a wide network of people and helps them to get information about the events happening in the world.

An internet tool for interaction, information sharing, and social networking is social media. Networking software that connects people around the world is an internet-based technology, strictly understood.

Therefore, option B is appropriate.

Learn more about Communication, here:

https://brainly.com/question/22558440

#SPJ5

Social media is a tool that enables people to connect and exchange ideas. Therefore, the correct answer is option B.

The exchange of information between two people in the form of conversation, opinion, suggestion, or advice with the use of a medium or direct interaction is referred to as communication.

Social media is referred to as a communication tool that enables individuals to communicate their thoughts, ideas, and opinions with a large network of people and assists them in learning about global events.

Social media is an online medium for communication, sharing of knowledge, and social networking. According to the definition of the term, internet-based technology includes networking software that links individuals worldwide.

Therefore, the correct answer is option B.

Learn more about communication here:

brainly.com/question/22558440

#SPJ6

What device to use when downloading a large file?

Answers

Pc is a device to downloading load file

A general rule for printing is to use _____ fonts for headlines and serif fonts for body text. sans-serif fantasy cursive monospace

Answers

Answer:

sans-serif

Explanation:

Fonts can be defined as a graphical representation of texts which includes a collection of characters such as numbers, letters, symbols etc in various size, color, typeface, design or weight.

A general rule for printing is to use sans-serif fonts for headlines and serif fonts for body text. This ultimately implies that, for any printed work such as novels, books, newspapers etc, it is a general rule for a printer to use sans-serif fonts for headlines and serif fonts for body text in order to enhance readability.

Also, it can be reversed in some instances by using a serif font for headlines and a sans-serif font for the body of a text.

An ISP is considering adding additional redundant connections to its network. Which of the following best describes why the company would choose to do so?

Answers

Answer:

Redundant networks are generally more reliable.

Explanation:

The complete question is in this brainly link;

https://brainly.com/question/18302186

This is based on knowing the importance of a redundant network.

C. Redundant networks are more reliable

A redundant network is one that helps to increase the reliability of a computer system.

Now, this is possible because the more critical the ISP NETWORK is, the more important it will be for the time it takes to resolve from a fault would be reduced.

This implies that, by adding one redundant device to their connection, the time it will take to resolve from a fault would be drastically reduced and this will lead to a far more reliable system.

Thus, redundant networks are more reliable.

Read more at; brainly.com/question/17878589

Write a program that performs the following tasks: Display a friendly greeting to the user Prompt the user for the value to convert (a String) Accept that String Prompt the user for the value of the initial base (an integer) Accept that integer Prompt the user for the desired base of the output (an integer) Accept that integer If the String is not a legal expression of a number in the initial base, display an error message and exit the program. Convert the value represented by the String in the initial base to the desired base. Display the result.

Answers

Explanation:

import java.util.Scanner;

import java.math.BigInteger;

public class Main

{

private int x;  

public static boolean isValidInteger(String theValue, int theBase)

{    

BigInteger number = new BigInteger(theValue,theBase);

if(theValue.equals(number.toString(theBase)))

{

return true;

}

else

return false;

}

public static String convertInteger(String theValue, int initialBase, int finalBase)

{

boolean valid=isValidInteger(theValue,initialBase);

if(valid==true)

{

BigInteger number = new BigInteger(theValue);

return(number.toString(finalBase));

}

else

return("String not in initial base");  

}

public static void main(String[] args)

{

System.out.println("Welcome");

String value;

int ibase, dbase;

if(args.length==0)

{

Scanner S = new Scanner(System.in);

System.out.println("Enter Value to be converted :: ");

value = S.nextLine();

System.out.println("Enter initial base :: ");

ibase = S.nextInt();

System.out.println("Enter desired base :: ");

dbase = S.nextInt();

}

else

{

value=args[0];

ibase=Integer.parseInt(args[1]);

dbase=Integer.parseInt(args[2]);

}

  System.out.println("Change base "+convertInteger(value,ibase,dbase));  

}

}

Output

One of the simplest and best known polyalphabetic ciphers is _________ cipher. In this scheme, the set of related monoalphabetic substitution rules consists of the 26 Caesar ciphers with shifts of 0 through 25. Each cipher is denoted by a key letter which is the ciphertext letter that substitutes for the plaintext letter a.

Answers

Answer:

Vigenere

Explanation:

Vigenere Cipher is an encryption method of alphabetic symbols that utilizes an easy form of polyalphabetic exchange which is carried out through Vigenere table.

Hence, in this situation, the correct answer is VIGENERE Cipher because it is the form of cipher whereby the set of related monoalphabetic substitution rules comprises of the 26 Caesar ciphers with shifts of 0 through 25. Each cipher is indicated by a key letter which is the ciphertext letter that substitutes for the plaintext letter.

What makes Java platform independent?

Answers

Answer:

Java it is the use of Byte code that makes it platform independent.

Explanation:

Java platform independent language allows its the end users to access they source code and other language automatically,its a human readable language.

Java is created in the James Gosling at the sun micro systems,and java is an open source programming language, generally the people refer the java because its source connections.Java code may be use sequence of machine that can be use executed by the directly CPU,and all the program in java are compiled by java c.Java is an independent platform and variety of methods, its object oriented language, and java is study platform.Java program are compiled into byte code and that byte code is platform independent, and they machine execute the byte code the java virtual machine.Java is the platform independent because it does not depend on the type of platform,and the virtual machine also interpret the representations.Java compiler is the .class file or the byte code and the machine native code,java is that depend on java virtual machine.Java is does not required any licence to the run and they also reliable platform to work on.

Why do I have two random warnings?

Answers

Just a guess, maybe you’ve been reported for having an incorrect answer two times? I’m really not sure I’m just trying to give out possibilities. Maybe if your a Brainly Helper you haven’t been active so they are giving you warnings? Does clicking on the warning tell you the reason for them? Maybe the system thinks your a robot? I’m not sure just trying to give possible reasons, but you could try contacting customer support, but they aren’t always the quickest at responding.

Have a good day!

Answer:

bc of katie

Explanation:

Other Questions
Which of the following are powers the Continental Congress had under the Articles of Confederation? Describe the region enclosed by the circle x^2 +y^2 = 11x in polar coordinates. Inequalities (Please help!) erwfehaitdryefjk evg5rmd fhbc tg8 What has 2 protons and 2 neutrons in the center of the atom What feeling do you get from the wordharmony in paragraph 2?A. The croaking is a little annoying.B. The frogs croak day and night.C. The frogs make beautiful music.D. The croaking can barely be heard. Find the values of x is 1/x + 1/x+2 undefined? Can't use google! Due in 10 minutes! I will mark you the brainliest!How does identifying ecological hotspots help maintain biodiversity? The last stage of the stress response is resistance.TrueO False How many solutions does this equation have?-9p = 6 - 10p Which process occurred when water droplets formed on the grass Point G is the incenter of the triangle. Point G is the incenter of triangle E D F. Lines are drawn from each point of the triangle to point G. Lines are drawn from point G to the sides of the triangle. Angle D F G is 16 degrees. Angle G F E is (2 x) degrees. What is the value of x? 4 8 24 32 Write a brief explanation on how to simplify radicals How do I solve 25-+3? Step by step 10. Lord of the Rings: Return of the King won eleven Oscars (Academy Awards). Fact or Opinion Explain: _____________________________________________________________ Translate into Algebra.Jen had D dollars. She bought a video. Now she has R dollars. How much did she pay for the video? 3. Which statement summarizes the social contract described by John Locke and Jean-Jacques Rousseau? Solve for x: 3x7=7x+13 I am like most Americans and vote on individual issues. I try to stay open minded and my attitude on an issue can change based on learning something new. Like, when I saw that movie "Vegucation" and became a Vegan. 13. Adding up all of theof all of the individual atoms within one molecule of a compound will determine the molecular mass of the compound.A. atomic numbersB. electronsC. atomic massesD. protons