title: Substitution Cipher
body: <p>I am working on a program for a substitution cipher that wants me to ask the user for a file containing a key with the cipher text and plain text and to ask the user for a text file containing the message they would like to use before asking if they would like to encrypt or decrypt.</p>
  
  <p>I have a good bit of the program already finished, but I am having trouble reading the key text file into an ArrayList.</p>
  
  <p>the text file for my test key is:
  ZA
  YB
  XC
  WD
  VE
  UF
  TG
  SH
  RI
  QJ
  PK
  OL
  NM
  MN
  LO
  KP
  JQ
  IR
  HS
  GT
  FU
  EV
  DW
  CX
  BY
  AZ</p>
  
  <p>the code for my process is:</p>
  
  <pre><code>public class Process{
  
  public static void main(String[] args){
  
     ArrayList&lt;Key&gt; key = new ArrayList&lt;Key&gt;();
     String choice;
     String cipher;
     String plain;
  
  
     Scanner scan = new Scanner(System.in);
  
  
     //asks user for file name with cipher key
     System.out.print("Enter a file name containing your key: ");
     String fileName = scan.next();
  
  
  
     // ask user to encrypt or decrypt using the key
     System.out.print("Would you like to encrypt or decrypt? ");
     choice = scan.next();
  
     // ask for name of file containing message
     System.out.println("Enter a file name containing your message: ");  
     String fileName2 = scan.next();
  
     //perform the appropriate substitution on the message
     if (choice.equals("encrypt"))
     {
  
     }
  
     else if (choice.equals("decrypt"))
     {
  
     }
  
     //display both text and cipher
     for(Key ke : key)
     System.out.println(ke.getCipher() + "\n" + ke.getPlain());
  
     }
  }
  </code></pre>
  
  <p>Key class:</p>
  
  <pre><code>public class Key {
    //instance variables
     String cipher;
     String plain;
  
  
  
  public Key(String cipher, String plain) {
   this.cipher = cipher;
   this.plain = plain;
  }
   /**
   * getCipher - returns cipher
   * 
   * @return     cipher
   */
  
    public String getCipher() {
       return cipher;
   }
   /**
   * setCipher - updates cipher name
   * 
   * @param  newCipher   new value of cipher 
   */
  
    public void setCipher(String newCipher) {
        cipher = cipher;
    }
    /**
   * getPlain - returns plain
   * 
   * @return     plain
   */
  
    public String getPlain(){
        return plain;
    }
    /**
   * setPlain - updates plain name
   * 
   * @param  newPlain   new value of plain 
   */
  
    public void setPlain(String newPlain){
        plain = plain;
    }
    /**
   * toString - returns contents of object
   * 
   * @return    result
   */
  
    public String toString() {
        String result;
        result ="Ciphered text = " + cipher;
        result +="Plain text = " + plain;
        return result;
      }}
  </code></pre>