Saturday, December 28, 2013

Blue pelican Java Project 17b
































































































































































































































































































































































































































































































































My fellow students and I have been struggling to comprehend this lesson given to us over this break. The project's description is as follows:
































































































































































































































































































































































































































































































































You have just been hired by the CIA as a programmer in the encryption department. Your job is































































































































































































































































































































































































































































































































to write a class called Crypto. One method, encrypt, will accept a String that represents the































































































































































































































































































































































































































































































































sentence to be encrypted. It will return a String that is the sentence with all v’s (big or small)































































































































































































































































































































































































































































































































replaced with “ag’,r”, all m’s (big or small) with “ssad”, all g’s (big or small) with “jeb..w”, and































































































































































































































































































































































































































































































































all b’s (big or small) with “dug>?/”.
































































































































































































































































































































































































































































































































There are two classes: Crypto and Tester. Tester is given as:
































































































































































































































































































































































































































































































































import java.io.*;































































































































































































































































































































































































































































































































import java.util.*;































































































































































































































































































































































































































































































































public class Tester































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































public static void main(String args[])































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































Scanner kbReader = new Scanner(System.in);































































































































































































































































































































































































































































































































System.out.print(“Enter a sentence that is to be encrypted: ”);































































































































































































































































































































































































































































































































String sntnc = kbReader.nextLine( );































































































































































































































































































































































































































































































































System.out.println(“Original sentence = ” + sntnc);































































































































































































































































































































































































































































































































Crypto myCryptObj = new Crypto( );































































































































































































































































































































































































































































































































String encryptdSntnc = myCryptObj.encrypt(sntnc);































































































































































































































































































































































































































































































































System.out.println(“Encrypted sentence = ” + encryptdSntnc);































































































































































































































































































































































































































































































































String decryptdSntnc = myCryptObj.decrypt(encryptdSntnc);































































































































































































































































































































































































































































































































System.out.println(“Decrypted sentence = ” + decryptdSntnc);































































































































































































































































































































































































































































































































}































































































































































































































































































































































































































































































































}
































































































































































































































































































































































































































































































































While the progress I have made on Crypto is:
































































































































































































































































































































































































































































































































class Crypto































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































private String sntnc;































































































































































































































































































































































































































































































































public String Crypto (String sntnc)































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































String x = sntnc;































































































































































































































































































































































































































































































































return x;































































































































































































































































































































































































































































































































}































































































































































































































































































































































































































































































































public String encrypt(String sntnc)































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































String finalSntnc = "";
































































































































































































































































































































































































































































































































for(int y = 0; y < sntnc.length( ); y++)































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































char nextChar = sntnc.charAt(y);































































































































































































































































































































































































































































































































switch (nextChar)































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































case 'v':































































































































































































































































































































































































































































































































case 'V':































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































finalSntnc = finalSntnc + "ag\',r";































































































































































































































































































































































































































































































































break;































































































































































































































































































































































































































































































































}
































































































































































































































































































































































































































































































































case 'm':































































































































































































































































































































































































































































































































case 'M':































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































finalSntnc = finalSntnc +"saad";































































































































































































































































































































































































































































































































break;































































































































































































































































































































































































































































































































}































































































































































































































































































































































































































































































































case 'g':































































































































































































































































































































































































































































































































case 'G':































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































finalSntnc = finalSntnc + "jeb..w";































































































































































































































































































































































































































































































































break;































































































































































































































































































































































































































































































































}
































































































































































































































































































































































































































































































































case 'b':































































































































































































































































































































































































































































































































case 'B':































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































finalSntnc = finalSntnc + "dug>?/";































































































































































































































































































































































































































































































































break;































































































































































































































































































































































































































































































































}
































































































































































































































































































































































































































































































































default:































































































































































































































































































































































































































































































































{































































































































































































































































































































































































































































































































finalSntnc = finalSntnc + nextChar;































































































































































































































































































































































































































































































































}































































































































































































































































































































































































































































































































}
































































































































































































































































































































































































































































































































}































































































































































































































































































































































































































































































































return finalSntnc;































































































































































































































































































































































































































































































































}
































































































































































































































































































































































































































































































































I am stuck and can't seem to finish the project. Is there anyone that can help me?































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































































No comments:

Post a Comment