From 653af0e66bd9b81fa6b202d1676e0d933db93ee3 Mon Sep 17 00:00:00 2001 From: Emir Selim Kayhan Date: Fri, 30 Jan 2026 19:49:24 +0300 Subject: [PATCH] Bugs fixed code can run MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit missing parts added and code can run properşy --- Cipher.java | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/Cipher.java b/Cipher.java index 7527c5b..291b7ed 100644 --- a/Cipher.java +++ b/Cipher.java @@ -15,7 +15,7 @@ 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; @@ -26,7 +26,11 @@ 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 +46,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); } } }