I am trying to create a program that changes 'a' to 'd', 'b' to 'e', etc. I have written some code and keep getting this error message:
Error: Main method not found in class ec1, please define the main method as: public static void main(String[] args) or a JavaFX application class must extend javafx.application.Application
Here is my code:
public class ec1 {
private String ALPHABET = "abcdefghijklmnopqrstuvwxyzabc";
public String encrypt()
{
Scanner scan2 = new Scanner(System.in);
System.out.println("Enter your message");
String poop = scan2.toString();
int key = 3;
String code="";
for(int i=0;i<poop.length();i++)
{
int a = ALPHABET.indexOf(poop.charAt(i));
int keyVal = (key+a)%26;
char replaceVal = this.ALPHABET.charAt(keyVal);
code += replaceVal;
}
return code;
}
}