clyde1993's Profile User Rating: -----

Reputation: 3 Apprentice
Group:
Members
Active Posts:
38 (0.05 per day)
Joined:
15-February 12
Profile Views:
458
Last Active:
User is offline Sep 13 2013 06:46 AM
Currently:
Offline

Previous Fields

Country:
US
OS Preference:
Mac
Favorite Browser:
FireFox
Favorite Processor:
AMD
Favorite Gaming Platform:
Playstation
Your Car:
Mercedes
Dream Kudos:
0

Latest Visitors

Icon   clyde1993 has not set their status

Posts I've Made

  1. In Topic: If statements && mod not working as expected

    Posted 12 Dec 2012

    Thank you, that was extremely helpful, both of you.
  2. In Topic: Encrypting Code, getting a nullpointer error

    Posted 11 Dec 2012

    public void encrypt()
    	{
    		int rows = getLength()/getKeyLength();
            int col = getKeyLength();
    		char[][] code = new char[rows][col];
    		int i = 0;
    		for(int x=0;x<rows;x++)
    		{
    			for(int y=0;y<col;y++)
    			{
    				code[x][y] = text.charAt(i);
    				i++;
    			}
    		}
    		String sortedKey = sortKey();
    		String keyCode = "";
    		for(int x=0;x<getKeyLength();x++)
    		{
    			int currentPosition = sortedKey.indexOf(key);
    			for( int y=0; y<getKeyLength();y++)
    			{
    				keyCode += code[y][currentPosition+1];
    			}
    		}
    		key = keyCode;
    		
    	}
    
    


    I am getting the error
     Please enter a line of text 
    Hey
    HEY
    HEY
    HEY
    HEY
    HEY
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
    	at transCipherText.encrypt(transCipherText.java:32)
    	at prog6Driver.main(prog6Driver.java:19)
    
    
    
  3. In Topic: Encrypting Code, getting a nullpointer error

    Posted 11 Dec 2012

    *bump* need help please
  4. In Topic: Encrypting Code, getting a nullpointer error

    Posted 11 Dec 2012

    now I'm getting
     Please enter a line of text 
    Hello
    HELO
    HELO
    HELO
    HELO
    Exception in thread "main" java.lang.ArrayIndexOutOfBoundsException: -1
    	at transCipherText.encrypt(transCipherText.java:32)
    	at prog6Driver.main(prog6Driver.java:19)
    
    

    all i changed was line 19
    import java.util.Scanner;
     
    public class prog6Driver {
        
    	public static void main( String [ ] args ) {
    
    		String  plaintext;
    		String ciphertext;
    
    		rotCipherText  rotate;
    		transCipherText  transpose;
    
    		Scanner input = new Scanner(System.in);
    		System.out.println(" Please enter a line of text ");
    		plaintext = (input.nextLine( )).toUpperCase();
    		transpose = new transCipherText( plaintext , "NETWORK");
    		rotate = new rotCipherText( plaintext, 7 );
    		//I changed this next line
    		transpose.setKey(plaintext);
    		transpose.encrypt( );
    		rotate.rotate( );
    		System.out.println("Rotated value is " + rotate );
    		System.out.println("Transposed value is " + transpose);
    		rotate.setRot(-7);
    		transpose.decrypt();
    		rotate.rotate();
    		// should appear decrypted now
    		System.out.println("Rotated value is " + rotate );
    		System.out.println("Transposed value is " + transpose);
    
    		System.out.println(" Please enter another ine of text ");
    		plaintext = (input.nextLine( )).toUpperCase();
    
    		// this time we will rotate the value, THEN transpose it
    
    		rotate = new rotCipherText( plaintext, -5 );
    		transpose = new transCipherText( rotate.toString( ), "FIGURE");
    
    		// print out encrypted value
    		transpose.encrypt();
    
    		System.out.println("Rotated and Transposed value is " + transpose);
    
    		// now try to decrypt it…. Must reverse order of operations…
    
    		transpose.decrypt( );
    		rotate = new rotCipherText( transpose.toString( ), 5);
    		rotate.rotate( );
    
    		System.out.println("Decrypted value is " + rotate);
    		input.close();
    
    		}  // end main method
    
    
    		}
    
    
    
  5. In Topic: Encrypting Code, getting a nullpointer error

    Posted 11 Dec 2012

    It's coming from the text class which isn't being used. Any advice on how I can incorporate the text class bc as of now the key is null

My Information

Member Title:
New D.I.C Head
Age:
20 years old
Birthday:
July 21, 1993
Gender:
Years Programming:
3
Programming Languages:
C++, HTML

Contact Information

E-mail:
Click here to e-mail me
Facebook:
http://www.facebook.com/JoelSteele93

Friends

clyde1993 hasn't added any friends yet.

Comments

clyde1993 has no profile comments yet. Why not say hello?