I need help with the caesar cipher homework assignment, I am stuck and I do not know where to go in this problem. THis is the decoder which moves all the letters back three, but I do not know what is missing..

import java.io.*;
import java.util.Scanner;

public class AssignmentSix {
    public static void main(String[] args) throws IOException {
        //open file
        FileReader inputFile = new FileReader("cipher.txt");
        PrintWriter outputFile = new PrintWriter("plain.txt");

        //loop the characters of input file
        while(inputFile.ready()){
            char ch = (char) inputFile.read();
            //decode the character
            char decodedChar = decode(ch);
            outputFile.print(decodedChar);
        }
        //close files
        outputFile.close();
        inputFile.close();
    }
    public static char decode (char ch){
        char result = ch;
        if(charactersLetter(ch)){
            char upperCaseLetter = Character.toUpperCase(ch);
int unicodeVale = (int) upperCaseLetter;

int decodedVale = unicodeVale - 3;
if( decodedVale < 65){
    decodedVale += 26;  
}
result = (char) decodedVale;
return result;
        }
if(Character.isUpperCase('A')){
char val = Character.toUpperCase('a');

}

}
    public static boolean charactersLetter(char ch) {

        return 
    }




    }

what is in ready method?

Do you understand how caesar cipher works? Is your requirement to work with case-insensitive??? You attemp to ignore case letter which actually makes this matter more complicated. You should keep the letter case as it is while working. You should know that 'A' to 'Z' and 'a' to 'z' are 2 ranges of char values but they have the exactly the same range (26 between each). After subtracting the value, you could simply compare with the lowest char.

char decodeValue = ch - 3;  // flip backward 3 letters
// incoming letter is upper case && after flipping, it becomes out of range
// or
// incoming letter is lower case && after flipping, it becomes out of range
if ((ch>='A' && ch<='Z' && decodeValue<'A') ||
    (ch>='a' && ch<='z' && decodeValue<'a')) {
  decodeValue += 26;
}

Done the decoding part. You should see that I keep the char data type without changing to int even though I do some int addition.

PS: Your characterLetter() method is incomplete. You need to implement that.

what is in ready method?

It is documented in the API doc for it class (FileReader), just like every other API method.

Bulldogs: Please always post the complete text of the error messages you get from the compiler or the Java runtime. They usually tell you exactly what is wrong (and if not, we will help explain them).
Always indent your code properly before posting; nobody is goiung to bother to work out where loops and methods end when the indentation is wrong. You can download a choice of free programmer's editors to help with that.

@James Cherrill - alright. I forgot to check indentation before I posted this. I know I need characterLetter() method. But I am lost as to what is needed to be put into this method to make this program run properly.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.