For your final project, you’re going to create an encryption program. What’s encryption? Encryption is the process of using an algorithm to transform information and make it unreadable for...


For your final project, you’re going to create an encryption program. What’s encryption? Encryption is the process of using an algorithm to transform information and make it unreadable for unauthorized users.



Before you start on the project, be sure to watch this video:Encryption and Public Keys



NOTE:
The topics in the video WILL be on your final exam, so be sure to take notes. The video is



In the video, you’ll learn about theCaesar Cipher. Caesar’s Cipher uses an algorithm that substitutes each letter in a message with a letter a certain number of steps down in the alphabet.





Text, letter  Description automatically generated




The program you write will allow a user to input a message, checks to make sure that the message is alphanumeric, and returns a cipher of the user’s message. Once you’ve encrypted a message and chosen a key, you can run the program again and use the key to decrypt the message—unscrambling it to make it readable—and displaying the original message back to the screen.



This program is broken into two parts.


The first part is due this Sunday, November 22, by 11:59 p.m.


The second part will be due on Sunday, December 6, by 11:59 p.m.



NOTES FOR PART 1:


For part 1, do not do any input validation on your user’s input. Assume your user puts in valid information.


Do not do anything “extra” or go “above and beyond” the project requirements. The autograder is very particular. It is looking for exactly what we outline here.



Part 1



Declaring Your Variables



To get started, you’ll need five variables.



Remember, best practices tell us that a variable name should be camelCase and describe the content that the variable will hold.



The first variable you need will hold the characters that your message can contain.


Choose the correct data type and an appropriate name for your variable (I would call it something like myCharacters), then declare it and assign it this value:



ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz1234567890



You’ll also need variables for the following:



  • A variable to hold a numeric key (a whole number)

  • A variable to hold the user’s input message (alphanumeric)

  • A variable to hold the message after it is encrypted or decrypted (alphanumeric)

  • A variable to store a user’s choice from a numeric menu (a whole number)



Now we need to get input from the user. You’ll need a Scanner for this.



NOTE:


Pay close attention when you try to store the user’s input. You’ll need to use the correct method for the input type. You can read about this onW3 School’s User Input (Scanner)page.



Make your program display the following message:



Please enter a message:



NOTE: The autograder is VERY particular. You’ll have to make your program print this EXACT message.



Once the user inputs their message, you’ll need to store it in the variable you created to hold the user’s input message.



Use a Selection Statement



Next, make your program display the following message:



Enter 1 for encrypting and 2 for decrypting:



Store the user’s input in the variable you created for that purpose, and then write a selection statement.



If the user chooses 1, the program should display the following:



You chose encryption.



Then it should prompt the user:



Choose a numeric key for your cipher:



Once the user enters their key you should store it in the variable you created for that purpose.



If the user chooses 2, the program should display the following:



You chose decryption.



Then it should prompt the user:



Please enter the numeric key for your cipher:



Once the user enters their key you should store it in the variable you created for that purpose.



Now, using the same key variable, you’ll assign it the length of the myCharacters variable minus the current value of the key variable.



NOTE:


To get the length of the myCharacters’ variable, you must use theString length() method. The String length() method simply tells us how long a string is. DO NOT HARD CODE THIS VALUE. Use the String length() method.



Finally, close your Scanner.



Sample Output



Output 1:



Please enter a message:If you get stuck, please visit the tutoring center.


Enter 1 for encrypting and 2 for decrypting:1


You chose encryption.


Choose a numeric key for your cipher:42



Output 2:



Please enter a message:The tutoring center is open Monday - Saturday.


Enter 1 for encrypting and 2 for decrypting:2


You chose decryption.


Please enter the numeric key for your cipher:20



NOTE:


What you see in bold is what a user would enter.

Nov 22, 2021
SOLUTION.PDF

Get Answer To This Question

Related Questions & Answers

More Questions »

Submit New Assignment

Copy and Paste Your Assignment Here