java - Caesar Cipher with at least 5 methods -
i have been tasked with creating caesar cipher has main method, , has other methods named how want them within project requirements.
i have been emailing teacher's assistant , forth on since haven't been directly told anyway on how shift ascii lettering i've been trying around on google , here bit , have set not use many methods i've been asked or it's in c language.
my question stand is, netbeans ide 8.1 proper code shift .txt file.
if asked i'll put rubric if asked of me.
package mcintosh_project3; import java.io.file; import java.util.scanner; /** *james mcintosh *project 03 */ public class mcintosh_project3 { public static void main(string[] args, int option) throws exception { boolean run = true; file inputfile; if (option == 1) { scanner input = new scanner(system.in); system.out.println("what text file encrypt?"); string inputfile = input.nextline(); } if (option == 2) { scanner input = new scanner(system.in); system.out.println("what text file decrypt?"); string inputfile = input.nextline(); } if (option == 3) { run = false; } if (option > 3) { system.out.println("invalid option, please choose again."); } } public static int getmenuoption() throws exception { int option; scanner input = new scanner(system.in); system.out.println("1. encrypt"); system.out.println("2. decrypt"); system.out.println("3. quit"); system.out.println("what do?"); option = input.nextint(); return option; } public static int key(file inputfile, int option) throws exception { public static int key(file inputfile, int option) throws exception { char key = 'a'; if (option == 1) { key += 5; } if (option == 2) { key -= 5; } return key; } public static void encrypt(file inputfile, int key, int option) throws exception { if (option == 1) { key += 5; } system.out.println(inputfile); //incorrect of right } public static void decrypt(file inputfile, int key, int option) throws exception { if (option == 2) { key -= 5; } }
}
the errors coming these lines:
inputfile chara += 5; inputfile chara -= 5;
it looks trying can arrays, , every chara inputfile. that's not valid java, though. if want read file, you'll want use inputstream. check out example here.
hopefully gets started.
Comments
Post a Comment