How to Code Encryption Algorithm in Java?

Need help with java program, have no idea how todo this!?

  • Decoder - a Simple Encryption/Decryption Purpose: to provide an exercise using strings and associated methods. Forget the decoder ring in the cereal box - your Java program will translate any message they can! For this assignment, you will create a Java program that will encode or decode a text message, including blanks. You do not have to deal with punctuation marks. Do NOT use arrays to solve this lab – use appropriate String and StringBuffer methods. You will receive a zero for this lab, otherwise. There are TWO parts to this assignment. Part 1 Create a Decoder class definition in a single file (Decoder.java) that has a single method: public String decode(String msg, boolean encryptMode) Use a string, alpha, consisting of 27 characters which are the lower-case letters of the alphabet and the blank space in this order: "abcdefghijklmnopqrstuvwxyz "; Use the string, code, consisting of 27 characters which are jumbled up lower-case characters and a blank in this order: "fgwsaedrzxcvqtyuhjnbm kipol"; If encryptMode is true, then the method will encode the message from plaintext (readable text) into ciphertext (encrypted text) and return the encrypted string. That is, the input string (consisting of letters in the string, alpha) letters and blank spaces will be encrypted to the corresponding characters of the string, code. If encryptMode is false, then the method will translate (decrypt) the message from ciphertext into plaintext and return the translated string. Decoder.java should define two Boolean class constants, ENCRYPT and DECRYPT, that are true and false, respectively, and which can be used by the programs in Part 2. Part 2 Write two programs, TestEncrypt.java and TestDecrypt.java, that will use the Decoder class. These two programs are essentially identical, except that TestEncrypt uses the Decoder class to encrypt by setting the encryptMode to ENCRYPT. TestDecrypt, of course, uses the Decoder class to decrypt by setting the encryptMode to DECRYPT. Therefore, when you run TestEncrypt, your program creates a Decoder object that is used to translate plaintext into ciphertext, So, if you type in the sentence: this is fun it would be encrypted as: brznlznlemt When you run TestDecrypt, it creates a Decoder object that is used to translate ciphertext into plaintext. Thus, if you type in an encoded message: brznlznlemt it makes the translation into English as: this is fun 10% extra credit: The JOptionPane.showInputDialog() method will return null if the user clicks the Cancel button. Use this knowledge to make your programs loop as long as the user enters data and clicks OK. Submit the following zipped into a single file named LastNameFirstNameLab06.zip: Java application source files: Decoder.java, TestEncrypt.java, TestDecrypt.java Java class files (compiled): Decoder.class, TestEncrypt.class, TestDecrypt.class Captured application output in Word file

  • Answer:

    The instructions seem fairly clear to me. Which part are you stuck on? What don't you understand about it?

kennetht... at Yahoo! Answers Visit the source

Was this solution helpful to you?

Related Q & A:

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.