import java.util.*; import java.lang.*; class Program2 { static int vowelCount; static int key; static StringBuilder message; //This is the class constructor that initializes the message and key. public Program2( String text, int N ) { key = N; message = new StringBuilder(text); } //This is my encode method. public static void encode(){ int i = 0; int x=0; int totalLength= message.length(); while (i126){ x=encodedValue- 126; encodedValue= x+31; } while (encodedValue<32){ x=31-encodedValue; encodedValue=126-x; } char encodedChar= (char)encodedValue; message.setCharAt(i, encodedChar); i++; } System.out.println(message); } //This is the decode method. public static void decode(){ int i = 0; int x=0; int totalLength= message.length(); while (i126){ x=encodedValue- 126; encodedValue= x+31; } while (encodedValue<32){ x=31-encodedValue; encodedValue=126-x; } char encodedChar= (char)encodedValue; message.setCharAt(i, encodedChar); i++; } System.out.println(message); } //This is the main method. public static void main(String args[]) { vowelCount = 0; int numberOfCharacters; char letter; Scanner in = new Scanner(System.in); System.out.print("Enter the message: "); String s = in.nextLine(); System.out.print("Enter the key "); key = in.nextInt(); numberOfCharacters= s.length(); for (int i = 0; i< numberOfCharacters; i++) { letter = s.charAt(i); if ( letter == 'a' || letter == 'A'|| letter == 'e' || letter == 'E'|| letter == 'i' || letter == 'I'|| letter == 'o' || letter == 'O'|| letter == 'u' || letter == 'U'){ vowelCount++; } } message=new StringBuilder(s); System.out.print("would you like to encode or decode [E/D]: "); String string1Input = in.next(); if(string1Input.equals("E")){ encode(); } if(string1Input.equals("D")){ decode(); } while (!string1Input.equals("D") && !string1Input.equals("E")){ System.out.println("You entered an invalid entry"); System.out.print("would you like to encode or decode [E/D]: "); string1Input = in.next(); if(string1Input.equals("E")){ encode(); } if(string1Input.equals("D")){ decode(); } } } }