From 28cfec89a7a1dddd36f6dc1620eb8aa692e1c786 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emirhan=20Efe=20Su=C3=A7eken?= Date: Fri, 26 Sep 2025 14:31:27 +0300 Subject: [PATCH] all bugs fixed --- Cipher.java | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/Cipher.java b/Cipher.java index 7527c5b..6002eac 100644 --- a/Cipher.java +++ b/Cipher.java @@ -15,19 +15,21 @@ public String encrypt(String inputString) { // for all chars in the input string for (int i = 0; i < inputString.length(); i++) { - + outputString += replaceChar(inputString.charAt(i), true); } return outputString; } public String decrypt(String inputString) { - // output string will be collected in this variable, one char at a time String outputString = ""; - replaceChar('a',true); - + for (int i = 0; i < inputString.length(); i++) + { + outputString += replaceChar(inputString.charAt(i), false); + } + return outputString; } @@ -42,7 +44,7 @@ private char replaceChar(char inputChar, boolean isEncrypt) { for (int i = 0; i < ORIGINAL_ALPHABET.length(); i++) { if(ORIGINAL_ALPHABET.charAt(i) == inputChar) { - + return CIPHER_ALPHABET.charAt(i); } } }