import java.io.*;
import hsa.Console;
import java.awt.*;
public static void main(String[] args) throws IOException {
c = new Console();
String sentence;
String encrypt = "";
String vowels = "AEIOUaeiou";
final String PUNCTAUTION = ".,;?!\"\\/\' -";
StringBuffer removePunctation = new StringBuffer();
StringBuffer thirdLetters = new StringBuffer();
char tempChar;
//Open The Output File
PrintWriter output;
output = new PrintWriter(new FileWriter("output.txt"));
c.println("Please enter the sentence you would like to encrypt");
sentence = c.readLine();
for (int i = 0; i < sentence.length(); i++) {
tempChar = sentence.charAt(i);
if (PUNCTAUTION.indexOf(tempChar) == -1) {
encrypt = encrypt + tempChar;
}
}
if (encrypt == 'A') {
sentence.replace('A', '!');
} else if (encrypt == 'I') {
sentence.replace('I', '#');
} else if (encrypt == 'E') {
sentence.replace('E', '@');
} else if (encrypt == 'O') {
sentence.replace('O', '$');
} else if (encrypt == 'U') {
sentence.replace('U', '%');
}
c.println(encrypt.toString().toUpperCase());
output.println(encrypt.toString().toUpperCase());
}
句読点とスペースをすべて削除し、母音 AEIOU を !@#$% に変更しようとしていますが、エラーが発生します。また、一番下の文から置き換えた母音を出力して反転させようとしています。