Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 3 of 3

Thread: PLEASE Help With Ceasar Cipher Program!!

  1. #1
    Junior Member
    Join Date
    Oct 2011
    Posts
    6
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default PLEASE Help With Ceasar Cipher Program!!

    This is what I have so far below. The //comments are what I am supposed to do but do not know how. I think I need a driver.java too. PLEASE help. I can attach the .java files if need be.





    import java.io.*;
    import java.util.Scanner;
    import java.io.*;
    public class assign3{
                   public static void main(String[] args) throws IOException{
                	   Scanner key = new Scanner(System.in);
                       String choice = key.nextLine();           //Create string variables, choice, input, and output
                       System.out.println("Do you want to encrypt or decrypt?");         //get the encrypt/decrypt choice
                       System.out.println("Enter input file");         
                       Scanner keyb = new Scanner(System.in);
               			String path = keyb.nextLine();              //get the input file path
     
     
     
     
     
               		      //get the ouput file path
                                  //create an int variable
                                  //get the key value
                                  //make a new scanner to read from a file
                                  //make a new printwriter to write to the output file
                                  //create cipher object c with int variable as argument
                                  if(choice.equals("encrypt")){
                                                 while(/*scanner associated with file has next line*/){
                                                                //read a line from the file store it in a string called, say, indata
                                                                //create a string variable called, say, outdata
                                                                outdata = c.encryptLine(indata);
                                                                //write outdata to file
     
    }
                                  }
                                  else{
                                                 //do the same for decrypting
                                  }
                                  //close PrintWriter
     
    }
    }


  2. #2
    Administrator copeg's Avatar
    Join Date
    Oct 2009
    Location
    US
    Posts
    5,320
    Thanks
    181
    Thanked 833 Times in 772 Posts
    Blog Entries
    5

    Default Re: PLEASE Help With Ceasar Cipher Program!!

    You will increase the probability of receiving a meaningful answer if you ask one question at a time (posting the question outside the code you posted). I say this because I honestly don't know at what step you are stuck, and thus what advice to give.

    Break the problem down to the requirements - then ask one question in turn. The following is a good article on how to accomplish this: How to program - stuck on homework?

  3. #3
    Think of me.... Mr.777's Avatar
    Join Date
    Mar 2011
    Location
    Pakistan
    Posts
    1,136
    My Mood
    Grumpy
    Thanks
    20
    Thanked 82 Times in 78 Posts
    Blog Entries
    1

    Default Re: PLEASE Help With Ceasar Cipher Program!!

    It looks like as you copied the whole code from somewhere, coz if you really don't know, what to do with comments, it clearly seems that you copied this and want us to code it for you.

    You can't even make a simple initialization? Or you didn't even bother to read that comments?

    Remember, we don't do homework for you.

Similar Threads

  1. Cipher Program
    By Shyamz1 in forum Object Oriented Programming
    Replies: 2
    Last Post: September 20th, 2011, 04:11 PM
  2. mod 95 vigninere cipher
    By fortune2k in forum Algorithms & Recursion
    Replies: 4
    Last Post: December 5th, 2010, 09:43 PM
  3. creating a ceaser cipher
    By fortune2k in forum Algorithms & Recursion
    Replies: 3
    Last Post: November 15th, 2010, 09:36 AM
  4. TCP chat attaching cipher is not running
    By Koren3 in forum Java Networking
    Replies: 4
    Last Post: May 19th, 2009, 02:52 AM
  5. [SOLVED] Interesting error cipher while sending message
    By Koren3 in forum Java Networking
    Replies: 0
    Last Post: April 29th, 2009, 09:54 AM